Use virtual environments, then pip
would be associated with the python
used to create that virtual environment. Whether you use pip
or pip3
, it will be equivalent to python3 -m pip
as mentioned in jakub's answer. Also, given that Python 2.7 is already EOL (which means you will most likely work with Python 3) and that pip install
-ing things onto the system packages should be avoided, then a virtual environment would be helpful here.
For example, using pipenv
:
$ pipenv --python=/usr/local/opt/python@3.8/bin/python3
$ pipenv shell
Launching subshell in virtual environment...
(TEMP) $ pip --version
pip 20.2.3 from /Users/me/.venvs/temp2-SbXvZiFd/lib/python3.8/site-packages/pip (python 3.8)
(TEMP) $ pip3 --version
pip 20.2.3 from /Users/me/.venvs/temp2-SbXvZiFd/lib/python3.8/site-packages/pip (python 3.8)
For example, using venv
:
$ python3.8 -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip --version
pip 20.2.3 from /Users/me/temp2/.venv/lib/python3.8/site-packages/pip (python 3.8)
(.venv) $ pip3 --version
pip 20.2.3 from /Users/me/temp2/.venv/lib/python3.8/site-packages/pip (python 3.8)
The virtual environment takes care of making sure pip
or pip3
in this env refers to the pip
from the correct Python version. You can then happily follow tutorials that still use pip install something
(unless of course that tutorial refers to a Python 2.7 or a system-wide installation).