Multiple python installations

One common challenge with multiple python installations is installing packages to one installation while running another.

Warning

Best bet might be to avoid multiple python installations if possible.

However, if you insist …

Installing packages to a particular python installation

The typical pip installation process:

$ pip install seaborn

Is a bit vague in that it doesn’t specify exactly which python installation we’re using. An equivalent, but more explicit, version of the above statement is:

$ /usr/bin/python3 -m pip install seaborn

where /usr/bin/python3 is the path to some particular python installation. Your own path will likely look different from this.

So how do I find where my own installation is?

To find it, type the following at any python prompt:

>>> import sys
>>> print(sys.executable)

And it’ll print out the executable file of the currently running installation.

Note

Do not type the `>>> ` or `$ ` signs above when giving the commands. `>>> ` indicates the command should be run in a python prompt like jupyter or spyder while `$ ` indicates a terminal / command prompt.