Reputation: 83
I am running python3 on Linux Mint, and am trying to set up VirtualEnvWrapper.
I have both virtualenv and virtualenvwrapper installed:
Running sudo pip3 install virtualenv
, returns Requirement already satisfied: virtualenv in ./.local/lib/python3.5/site-packages (15.1.0)
Running sudo pip3 install virtualenvwrapper
, returns Requirement already satisfied: virtualenvwrapper in /usr/local/lib/python3.5/dist-packages (4.8.2)
virtualenv is in /home/username/.local/bin/virtualenv virtualenvwrapper.sh is in /usr/local/bin/virtualenvwrapper.sh
My .bash_profile looks like:
source ~/.profile
export WORKON_HOME=~/Envs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
When I run source ~/.bash_profile
and then mkvirtualenv TestEnv
, I return the following error:
bash: /usr/local/bin/virtualenv: /usr/bin/python: bad interpreter: No such
file or directory
I think this is an issue with my .bash_profile and the location of the virtualenv vs virtualenvwrapper files. Is anyone able to help me correct my bash_profile to resolve this. I have tried various solutions offered on other threads, but none have helped.
Many thanks
Addition:
This is a selection of the contents of my /usr/bin directory (i.e. ls
). I'm not sure why python
is in red but it is neither a file nor a directory
Upvotes: 2
Views: 987
Reputation: 4529
Since you're using python3, I would check this file: /usr/local/bin/virtualenv
. Be sure that, on the 1st line there you have something like:
#!/usr/bin/python3
Save the file and try again.
I'm pretty sure that right now you have /usr/bin/python which most probably referrs to python2 and not 3. So you're trying to run a python3 script using python2 (that's why you get a bad interpreter error).
Since /usr/bin/python
is a symbolic link to a file that no longer exists at that location, the /usr/bin/python
is show with red.
Delete it with sudo: sudo rm -f /usr/bin/python
Then re-create the symlink using the following syntax: ln -s /path/to/source /path/to/destination
(in your case /usr/bin/python)
Then try execute /usr/local/bin/virtualenv
and see if it works.
Upvotes: 3