Jump to content

Python/pip (package manager)

From Wikiversity

pip is a de facto standard package-management used to install and manage software packages written in Python.

Sub Commands

[edit | edit source]
  • pip install <package> This command is used to install packages from PyPI[1]
  • pip uninstall <package> This command is used to remove packages within your environment.[2]
  • pip list This command is used to list all installed packages[3]
  • pip show -f <package> Used to show general detail about a package[3]
  • pip check Checks that all installed packages have compatible dependencies.

General Options

[edit | edit source]
  • -h Shows all the sub-commands of pip.[4]
  • --help Long version of -h, shows all the sub-commands of pip[4]
  • -r This enables the instillation of packages as defined in a 'requirements.txt' file, in order to specify a file, add the file's directory after the -r.

Requirements File (-r)

[edit | edit source]

This is a feature of pip, which allows the user to specify each package they wish to install in a text file. This is often done in repositories, and allows users to quickly and easily install packages necessary for a specific piece of code. Note that version numbers are optional.

requirements.txt example
apt-clone==0.2.1
apturl==0.5.2
asdf==2.8.3
attrs==21.4.0
beautifulsoup4==4.8.2
blinker==1.4
Brlapi==0.7.0
cached-property==1.5.1
certifi==2019.11.28
chardet==3.0.4


References

[edit | edit source]
  1. "User Guide - pip documentation v22.0.4". pip.pypa.io. Retrieved 2022-04-11.
  2. "User Guide - pip documentation v22.0.4". pip.pypa.io. Retrieved 2022-04-11.
  3. 3.0 3.1 "User Guide - pip documentation v22.0.4". pip.pypa.io. Retrieved 2022-04-11.
  4. 4.0 4.1 Command: pip -h