virtualenvwrapper Error: The path python2 (from --python=python2) does not exist

Viewed 1400

I am trying to set up virtualenv with virtualenvwrapper on Ubuntuo 18.04, but when I try to run mkvirtualenv temp I get an error from virtualenvwrapper: The path python2 (from --python=python2) does not exist.

The relevant lines from .bashrc are:

147 # virtualenvwrapper variables
148 export WORKON_HOME=~/.virtualenvs
149 export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
150 export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
151 source /usr/local/bin/virtualenvwrapper.sh

If I run mkvirtualenv temp --python=python3, the environment is created as expected and works fine but I get the message Already using interpreter /usr/bin/python3 which tells me that .bashrc line 149 is correctly setting the variable.

The confusion I have is that I don't use Python2. I know that it is installed on the OS but is the default version for virtualenvwrapper Python 2.x? Even if it was I believe that lines 149 and 150 in .bashrc override this. Any suggestions are appreciated.

1 Answers

Specify the python version you want to use

mkvirtualenv venv -p /usr/local/bin/python3.6
Related