If you have multiple versions of Python installed on a system, such as both Python 2.7 and Python 3.6+. Then pip
will often refer to the Python2 bin, while pip3
will point to the Python3 bin.
You can easily tell what your own setup is by running the following commands in a terminal window / command-line.
$ which pip
$ which pip3
/usr/local/bin/pip3
It is also useful to know what version of Python you have on your system and where it is, as Pip is always coupled with it.
$ python --version
Python 2.7.16
This tells us that the python
version on our system is for Python 2.7.16, we can issue a which
command on it to see where it is on our system.
$ which python
/usr/bin/python
As it is possible to have multiple versions of Python installed on a system, let’s see if we have Python3 installed.
$ python3 --version
Python 3.7.5
We can see we do have Python3 installed, now let’s find out where it is.
$ which python3
/usr/local/bin/python3
Unless you have a specific reason to run Python2 and it’s accompanying Pip dependency installer, it is always recommended to run Python3 along with it’s local Pip.
This is yet another reason to always run Python Virtual Environments
, as you can guarantee and install dependencies to the local Python3 and Pip. Also, with a virtual environment, you only ever need to care about calling your scripts with the single python
executor, and install dependencies with the single pip
tool. As pip3
will just point back to the pip
tool itself.