pip3 常见用法总结
- 作者: 五速梦信息网
- 时间: 2026年03月19日 18:00
用法总览
pip3 --help
1
Usage:
pip [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user
configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times
(corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log Path to a verbose appending log.
--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries Maximum number of retries each connection should attempt (default 5 times).
--timeout Set the socket timeout (default 15 seconds).
--exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe,
(b)ackup, (a)bort.
--trusted-host Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert Path to alternate CA bundle.
--client-cert Path to SSL client certificate, a single file containing the private key and
the certificate in PEM format.
--cache-dir Store the cache data in .
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is
available for download. Implied with --no-index.
安装相关
安装指定包的最新版
pip3 install pkg_name
安装制定包的指定版本
pip3 install pkg_name==version
$ pip3 install django==2.0.5
移除指定包
pip3 uninstall pkg_name
1
在 PyPI 上模糊查找相关包
pip3 search pkg_name
1
查看相关
查看所有已安装的包
pip3 list
形如:
amqp (1.4.9)
anyjson (0.3.3)
asn1crypto (0.24.0)
查看指定包的相关信息
pip3 show pkg_name
$ pip3 show django
Name: Django
Version: 2.1.4
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: https://www.djangoproject.com/
Author: Django Software Foundation
Author-email: foundation@djangoproject.com
License: BSD
Location: /home/ezreal/.local/lib/python3.6/site-packages
Requires: pytz
1
freeze 的使用
列出所有已安装包
pip3 freeze
形如:
vine==1.1.4
virtualenv==16.1.0
youtube-dl==2018.9.10
生成 requirements.txt 文件
pip3 freeze > requirements.txt
---------------------
- 上一篇: 搭建你的专属短网址生成系统
- 下一篇: 简述python setup.py install的过程
相关文章
-
搭建你的专属短网址生成系统
搭建你的专属短网址生成系统
- 技术栈
- 2026年03月19日
-
Scrapy源码阅读分析
Scrapy源码阅读分析
- 技术栈
- 2026年03月19日
-
这4个Python实战项目,让你瞬间读懂Python!
这4个Python实战项目,让你瞬间读懂Python!
- 技术栈
- 2026年03月19日
-
简述python setup.py install的过程
简述python setup.py install的过程
- 技术栈
- 2026年03月19日
-
新建一个Scrapy工程
新建一个Scrapy工程
- 技术栈
- 2026年03月19日
-
用Python爬取实习信息(Scrapy初体验)
用Python爬取实习信息(Scrapy初体验)
- 技术栈
- 2026年03月19日
