[Python] pip commonly used commands (reprint)

The original pip competent so many things! Happiness soaring!

Mirror python open Tsinghua URL:
https://pypi.tuna.tsinghua.edu.cn/simple/
Example: pip install / uninstall XXX -i <mirror URL>

PIP
install
sudo easy_install pip

Lists packages installed
pip freeze or pip list

Export requirements.txt
PIP Freeze> <Directory> /requirements.txt

Installation package
online installation
pip install <package name> or pip install -r requirements.txt

> = <=> <Specify the version by using ==, do not write install the latest version

requirements.txt content format:

== 2.1.2 APScheduler
Django == 1.5.4
MySQL-Python-Connector == 2.0.1
MySQL-Python == 1.2.3
PIL == 1.1.7
South == 1.0.2
Django-Grappelli == 2.6.3
django-pagination == 1.0.7
install local installation package
pip install <directory> / <filename> or pip install --use-wheel --no-index --find-links = wheelhouse / < package name>

Spaces <package name> before

It can be abbreviated as

pip install --no-index -f = <directory> / <package name>

Uninstall package
pip uninstall <package name> or pip uninstall -r requirements.txt

Upgrade package
pip install -U <package name>

Or: pip install <package name> --upgrade

Upgrade PIP
PIP PIP install -U

Displays the directory where the
pip show -f <package name>

Search package
pip search <keyword search>

Queries can upgrade package
pip list -o

Download package without installing
pip install <package name> -d <directory> or pip install -d <directory> -r requirements.txt

Packing
pip wheel <package name>

Replace domestic pypi Mirror
domestic pypi mirrored
Ali: https://mirrors.aliyun.com/pypi/simple
University of Science and Technology of China: http://pypi.mirrors.ustc.edu.cn/simple/
specify a single installation source
pip install <package name> -i https://mirrors.aliyun.com/pypi/simple

To specify a global installation source
in unix and macos, configuration files: $ HOME / .pip / pip.conf
on the windows, the configuration file is:% HOME% \ pip \ pip.ini

[global]
timeout = 6000
index-url = https://mirrors.aliyun.com/pypi/simple

Guess you like

Origin www.cnblogs.com/frong24/p/11300700.html
Recommended