Reputation: 4059
I have several python versions installed (and working properly on my machines). Isn't there a way to execute a specific version of python from the command line.
Say I want to use python 3.1. I am after something a SIMPLE COMMAND such as python3.1
or python31
that would be used as follows :python3.1 setup.py install
, for instance.
[pip
has pip3.1
to install a library with the version 3.1 of python, specifically]
Upvotes: 0
Views: 175
Reputation: 4681
There are multiple ways to go about this. As Sir_FZ pointed out, the executables are already named python2.7
, etc, so what you want already exists. If for some really odd reason you have more than one python2.7 in your $PATH
, you can explicitly call /my/other/python2.7
etc. If you're lazy, you can even create alias's alias p2=/my/other/python2.7
and then you can call p2 setup.py install
If you're going to be doing this for more than a day, I'd suggest following one of Sagar's links.
Upvotes: 0
Reputation: 2266
Yes, this is possible, but the best approach varies depending on the OS you're using. For Windows, you want the py
launcher, for which instructions are here. For Mac OS X and Linux, you could use something like pyenv. Of course, you could always build your own solution using virtualenv.
Upvotes: 2