Reputation: 1351
I have compiled Python 2.7.6 from source in Ubuntu 12.0.4.3. It can be found in /opt/python276/bin/python2.7
I then created alias python276=/opt/python276/bin/python2.7
in .bashrc
in the bash terminal, I can type python276 and receive the correct interpreter, but when I try to create a virtualenv using virtualenvwrapper:
puffin@ubuntu:/opt/python276/bin$ mkvirtualenv test -p python276
The executable python276 (from --python=python276) does not exist
What am I missing? I can create virtualenvs with the system python, but not the compiled one.
** Edit **
I eventually found exactly what I was looking for.
The way to create a virtualenv without having to specify the actual path is by creating a symlink. In this situation, I would create a symlink from the Python executable to ~/bin
then prepend ~/bin
to my path.
ln -s /opt/python3.3/bin/python3.3 ~/bin/python33
echo 'export PATH=~/bin:$PATH' >> ~/.bashrc
I can then do mkvirtualenv testenv -p python33
Upvotes: 0
Views: 413
Reputation: 290165
Note an alias works when calling it. If you use it as a parameter of another command, it is not interpreted. Hence, in your mkvirtualenv ...
you should specify explicitly the path of this python.
Otherwise, you can set a variable
mypython276=/opt/python276/bin/python2.7
and then do
mkvirtualenv test -p $mypython276
As said in comments, you can also add /opt/python3.3/bin/
into the PATH
variable.
Upvotes: 1