https://pip.pypa.io/en/stable/
pip documentation
https://pypi.org/
Python Package Index
https://packaging.python.org/tutorials/installing-packages/
'pip' is the package installer for Python. You can use it to install packages from the Python Package Index (PyPI) and other indexes.
In Debian 10 Linux, there is 'pip' (Py2) and 'pip3' (Py3).
'pip' is already installed if you are using Python 2 >= 2.7.9 or Python 3 >= 3.4 downloaded from python.org or if you are working in a virtual environment created by 'virtualenv' or 'venv'.
# Testing if 'pip' is installed. $ pip --version # Debian 10 pip 18.1 from /usr/lib/python2.7/dist-packages/pip (python 2.7) $ pip3 --version # Debian 10 pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7) $ python -m pip --version # Py2, from pip documentation $ python3 -m pip --version # Py3, note the name 'pip', not 'pip3' here $ man pip # help in Debian Linux $ pip --help # usage and commands
APT (for the entire computer) Debian packages: python-pip, python-wheel, python-pip-whl, python3-pip, python3-wheel, and dependencies.
$ python3 -m pip install somepackage # latest version $ python3 -m pip install somepackage==1.0.4 # specific version $ python3 -m pip install "somepackage==1.0.4" # specific version $ python3 -m pip install "somepackage>=1,<2" $ python3 -m pip install --upgrade somepackage # -U, --upgrade $ python3 -m pip install somepackage-1.0-py3-none-any.whl # from a wheel archive $ python3 -m pip install somepackage-1.0.tar.gz # from a tar.gz archive $ python3 -m pip show somepackage # info about a package $ python3 -m pip show --files somepackage # show what files were installed $ python3 -m pip list # the list of packages installed $ python3 -m pip list --outdated # errors in Debian $ python3 -m pip uninstall somepackage $ python3 -m pip check # checking a system # No broken requirements found. $ python3 -m pip search "query" # errors in Debian
# Upgrading pip - it is safe in virtual environments. # For installig packages from binary archives $ python3 -m pip install --upgrade pip # For installing packages from source archives $ python3 -m pip install --upgrade pip setuptools wheel
As libraries get updated, results from running your code can change,
or your code can break completely. It’s important to be able to reconstruct
the set of packages and versions you’re using. Best practice is to:
(1) use a different environment per project you’re working on,
(2) record package names and versions using pip in 'requirements files'.
# This is done typically in virtual environments. $ python3 -m pip freeze > requirements.txt # output installed packages in requirements format $ python3 -m pip install -r requirements.txt # -r, --requirement