pip or pip3 to install packages for Python 3?
Your pip
is a soft link to the same executable file path with pip3
.
you can use the commands below to check where your pip
and pip3
real paths are:
$ ls -l `which pip`
$ ls -l `which pip3`
You may also use the commands below to know more details:
$ pip show pip
$ pip3 show pip
When we install different versions of python, we may create such soft links to
- set default pip to some version.
- make different links for different versions.
It is the same situation with python
, python2
, python3
More information below if you're interested in how it happens in different cases:
- MacOS/Homebrew
- Fedora/CentOS
- Debian/Ubuntu
If you had python 2.x and then installed python3, your pip will be pointing to pip3.
you can verify that by typing pip --version
which would be the same as pip3 --version
.
On your system you have now pip, pip2 and pip3.
If you want you can change pip to point to pip2 instead of pip3.
When you install python3
, pip3
gets installed. And if you don't have another python installation(like python2.7) then a link is created which points pip
to pip3
.
So pip
is a link to to pip3
if there is no other version of python installed(other than python3).
pip
generally points to the first installation.