Search code examples
pythonpython-3.xpip

python3 and pip is installed on Mac but pip3 command not found


I have Python3 installed on my Mac (with Anaconda), but when I tried to install a package using pip3, I received an error saying pip3 command not found. It seems no pip3 and also no python3-pip installed.

Some info:

(base) MacBook-Pro-8:~ mona$ python --version
Python 3.7.4
(base) MacBook-Pro-8:~ mona$ which python
/Users/mona/opt/anaconda3/bin/python
(base) MacBook-Pro-8:~ mona$ pip --version
pip 19.2.3 from /Users/mona/opt/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
(base) MacBook-Pro-8:~ mona$ which pip
/Users/mona/opt/anaconda3/bin/pip
(base) MacBook-Pro-8:~ mona$ pip3 --version
-bash: pip3: command not found
(base) MacBook-Pro-8:~ mona$ locate pip3
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/python/py-pip/files/pip33
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/python/py-pip/files/pip34
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/python/py-pip/files/pip35

Also, I see a different version of python3 when I use brew info python3:

enter image description here

Below are some of the similar questions I've already read:

What can I try next?


Solution

  • pip and pip3 are just two different names for the same program. Essentially, the only difference is the paths they are hard-coded to install into; pip is typically a version that installs to a Python 2 installation, and pip3 to a Python 3 installation.

    Inside your virtual environment, though, there typically is only one Python installation available; the purpose of the virtual environment is to provide "the" installation to use. As such, it simply uses names like pip and python for the commands rather than providing any kind of version-specific names. The names refer to whatever specific version was used to create the virtual environment.