Wednesday, June 18, 2014

12:00 AM
Good day!
In your linux machine or UNIX-like operating system, it might happen that you have to find full path python interpreter having multiple python installed. By default, most linux distros nowadays have already installed Python. Now if you download another python binary, and installed it. It will create new directory so you'll have another Python version.

Sometimes you may need to specify the exact Python(when all are different version). That case you can use the built in linux locate command to find all the python bin directory.

$ locate /bin/python


This command will display you all the directories consist with '/bin/python'. So from that list, you can easily identify all the Python bins. Now you can pick one


If you tend in upgrading or installing python you might also check and install more libs (Lzma, openssl, and more...) . The virtualenv will come in handy that could also help you organize with multiple python environments although from version 3.3 you have a built in virtual environment.

After you have identified all your installed python bin and versions, you can also check additional commands for checking versions and location of specified python bin.

To know what is the default python installed you can use the python version.

$ python -V


or

$ python --version

You can also use which and whereis command in finding the binary, for example:

$ which python2.7
$ whereis python3



The which  will show the default system Python, which will usually be something like /usr/local/bin/python.

The whereis command will return each interpreter's install path (or return nothing if it's not installed).

0 comments:

Post a Comment