About python’s pip command

runpython

python

【Ctrl】+【Z】Exit
Insert image description here

Check python version

python --version

Use domestic mirroring

# 临时使用清华的大学开源软件镜像
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

Note that simpleit cannot be less, is httpsrather thanhttp

Set as default.
Upgrade pip to the latest version (>=10.0.0) and then configure:

python -m pip install --upgrade pip
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

If your network connection to pip's default source is poor, temporarily use this mirror to upgrade pip:

python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

Configuring multiple mirror sources
If you want to configure multiple mirror sources to balance the load, you can continue to add origin sites in the following ways after replacing index-url:

pip config set global.extra-index-url "<url1> <url2>..."

Please replace the content within the quotation marks yourself. There needs to be a space between the source addresses.

Move out of domestic mirror source

pip config unset global.index-url

View installed packages

pip list

Insert image description here

Install a package, taking numpy as an example

pip install numpy

If the package has been installed, it will be displayed as installed, as follows
Insert image description here

Uninstall a package, taking numpy as an example

pip uninstall numpy

View the details of the package, taking numpy as an example

We can also use the show command to display complete information for a given package, which may be useful before uninstalling

pip show numpy

Insert image description here

pip upgrades the specified library file **** indicates the library file that needs to be upgraded, just replace it

pip install --upgrade  ****
pip install --upgrade  ****  -i  https://pypi.tuna.tsinghua.edu.cn/simple

Insert image description here

Guess you like

Origin blog.csdn.net/YSA_SFPSDPGY/article/details/132012946