Python3 pip

pip is a Python package management tool that provides the functions of searching, downloading, installing, and uninstalling Python packages.

Software packages can also behttps://pypi.org/found in.

The latest Python version currently comes with pip preinstalled.

Note: Python 2.7.9+ or Python 3.4+ and above versions come with the pip tool.

If it is not installed, you can refer to:Python pip installation and usage.

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

pip --version

To download and install packages, use the following command:

pip install some-package-name

For example, to install the numpy package:

pip install numpy

We can also easily remove packages using the following command:

pip uninstall some-package-name

For example, to remove the numpy package:

pip uninstall numpy

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

pip list

Export current Python environment configuration

To export the current Python environment configuration, you can use thepip freezecommand.

pip freezeThe command will list all Python packages installed in the current environment and their version information. You can save it to a file, such as requirements.txt, as shown below:

pip freeze > requirements.txt

The above command will create a file in the current directoryrequirements.txtthat contains all packages installed in the current environment and their version information.

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

pip install -r requirements.txt

The above command will, based onrequirements.txtthe packages and version information listed in, reinstall all required packages, thereby rebuilding the same environment.


Additional Content

Anaconda Introduction

The Anaconda distribution includes Python.

Anaconda is an integrated data science and machine learning environment that includes the Python interpreter as well as many commonly used data science libraries and tools.

The management tool for Anaconda packages, their dependencies, and environments iscondathe command, compared with the traditional Pythonpiptools, Anaconda'scondacan switch between different environments more conveniently, and environment management is relatively simple.

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

Other Extensions