pip is the same community-driven package space, but for Python.
The concept of packages is not unique to
pip. A package is a collection of code that is designed for a specific purpose. These packages are also meant to be re-used and distributed by other developers.
Python Package Index Repository (PyPI)
The Python Package Index Repository (PyPI), hosts a large collection of packages. The official package installer of PyPI is
pip, which is used in the command line. A good practice to understand how to use a package is reading its documentation on PyPI.
Documentation on PyPI typically comes with the following:
- A list of requirements to run the package.
- Instructions for installing the package.
- One or more examples of how the package is implemented.
pip commonly comes with the installation of Python. Therefore, the first step in installing
pip is verifying that it is already installed. This step can vary between versions of Python as well as what machine it is running on. The examples below are for version 3.6.3 and above. A good resource for more specific instructions would be the official Python tutorial on installing packages.
# Windowspy --version# Linux/macOSpython3 --version
It should be noted that as per the pip documentation,
pip maintainers are no longer supporting Python 2 and below.
The following command is run to check the latest version
# Windowspy -m pip --version# Linux/macOSpython -m pip --version
pip is already installed, its version will appear in the terminal.
pip is out of date, the following command will upgrade it:
# Windowspy -m pip install --upgrade# Linux/macOSpython -m pip install --upgrade
Finally, it is now possible to start installing packages from PyPI. In the following example, a fake package called
ACoolPackage will be used. This isn’t a real package on PyPI, rather it is just a placeholder for a real package. It is recommended to visit the PyPI page of the package being installed for more specific instructions.
py -m pip install ACoolPackage
- BrandonDusch580 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- Anonymous contributorAnonymous contributor9 total contributions