Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python3 pip

Python3 pip

pip is the Python package management tool, which provides functions for finding, downloading, installing and uninstalling Python packages.

Packages can also be found in https://pypi.org/ .

The latest Python versions come with pip preinstalled.

Note: Python 2.7.9+ or Python 3.4+ and above all include the pip tool.

If it is not installed, see:Python pip Installation and Usage.

To check whether pip is installed, use the following command:

pip --version

To download an installation package, use the following command:

pip install some-package-name

For example, to install the numpy package:

pip install numpy

We can also easily remove a package with the following command:


pip uninstall some-package-name

For example, to remove the numpy package:

pip uninstall numpy

To view the packages we have installed, use the following command:

pip list

Export the configuration of the current Python environment

To export the configuration of the current Python environment, you can use the pip freeze command.

The pip freeze command lists all Python packages installed in the current environment and their versions; you can save it to a file such as requirements.txt, as shown below:

pip freeze > requirements.txt

The above command creates a file named requirements.txt in the current directory, containing all packages installed in the current environment and their versions.

Then you can use that file elsewhere to recreate the same environment by running the following command:


pip install -r requirements.txt

The above command uses the packages and versions listed in requirements.txt to reinstall all required packages, thus rebuilding the same environment.


Further reading

Introduction to Anaconda

The Anaconda distribution includes Python.

Anaconda is an integrated data science and machine learning environment that includes the Python interpreter and a large number of commonly used data science libraries and tools.

Anaconda's tool for managing packages, dependencies and environments is the conda command. Compared with the traditional Python pip tool, Anaconda's conda makes it easier to switch between different environments, so environment management is simpler.

For detailed installation and introduction to Anaconda, see:Anaconda Tutorial.