python - pyenv variable not set when used with sudo - Stack Overflow
stackoverflow.com
You have to pass $USER env to sudo:
sudo env "PATH=$PATH VIRTUAL_ENV=$VIRTUAL_ENV" python myscript.py
#fixes #bash #python #pyenv #linux
Collect and share the web
Get started for free