Search code examples
pythonraspberry-pivirtualenvraspberry-pi3virtualenvwrapper

Installation fails Virtualenvwrapper and Virtualenvs does not contains an activate script


I use a RPI3B and try to install Virtualenvwrapper and Virtualenvs. After i add the

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

in the ~/.profile. Then source ~ ~/.profile I use mkvirtualenv cv -p python2. After that i get these message :

created virtual environment CPython2.7.16.final.0-32 in 672ms
creator CPython2Posix(dest=/home/pi/.virtualenvs/cv, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, 
app_data_dir=/home/pi/.local/share/virtualenv/seed-v1)
activators PythonActivator,CShellActivator,FishActivator,PowerShellActivator,BashActivator
virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/cv/usr/local/bin/predeactivate
ERROR: Environment '/home/pi/.virtualenvs/cv' does not contain an activate script.

But i cant use workon cv. The last Message come again and again. How can i fix it? I also try it to reinstall but it doesnt help.


Solution

  • I had the same error message when I used mkvirtualenv on a new RPI4. I added these lines to my .bashrc and it fixed the problem for me:

    export WORKON_HOME=$HOME/.virtualenvs
    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
    source /usr/local/bin/virtualenvwrapper.sh
    export VIRTUALENVWRAPPER_ENV_BIN_DIR=bin  # <== This line fixed it for me