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.
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.
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.
As it is possible to have multiple versions of Python installed on a system, let’s see if we have Python3 installed.
We can see we do have Python3 installed, now let’s find out where it is.
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.