pip管理python安装包
1、pip 查看已经安装的包以及依赖包关系
pip freeze
或pip list
或pip show 包名
python3. 使用 pip3 freeze
或pip3 list
或pip3 show 包名
区别在于:
2、安装或下载指定包及依赖包:
pip install -t d:\package\site-package requests #安装包到指定的目录下
pip download -d python38lib requests openssl #下载多个包及其依赖包到指定目录下
pip download -r requirement.txt #按requirement.txt文件中指定的包列表下载包,文件内容格式如下:
# keystone dependencies
pam>=0.1.4
WebOb==1.2.3
eventlet
greenlet
PasteDeploy
paste
routes
sqlalchemy>=0.7.8,<=0.7.9
sqlalchemy-migrate>=0.7.2
passlib
lxml
iso8601>=0.1.4
python-keystoneclient>=0.2.1,<0.3
oslo.config>=1.1.0
3、下面举一些应用例子:
G:\mytool>pip show requests
Name: requests
Version: 2.27.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: c:\users\dingb\appdata\roaming\python\python38\site-packages
Requires: certifi, charset-normalizer, idna, urllib3
Required-by:
G:\mytool>pipdeptree -p requests
requests==2.27.1
- certifi [required: >=2017.4.17, installed: 2021.10.8]
- charset-normalizer [required: ~=2.0.0, installed: 2.0.10]
- idna [required: >=2.5,<4, installed: 3.3]
- urllib3 [required: >=1.21.1,<1.27, installed: 1.26.8]
G:\mytool>pip freeze
altgraph==0.17.2
certifi==2021.10.8
charset-normalizer==2.0.10
click==7.1.2
colorama==0.4.4
future==0.18.2
idna==3.3
numpy==1.19.1
pefile==2021.9.3
pipdeptree==2.2.1
pyinstaller @ file:///G:/mytool/pyinstaller-4.8-py3-none-win32.whl
pyinstaller-hooks-contrib==2021.5
PyQt5 @ file:///G:/mytool/PyQt5-5.15.4-cp36.cp37.cp38.cp39-none-win32.whl
pyqt5-plugins==5.15.4.2.2
PyQt5-Qt5 @ file:///G:/mytool/PyQt5_Qt5-5.15.2-py3-none-win32.whl
PyQt5-sip @ file:///G:/mytool/PyQt5_sip-12.9.0-cp38-cp38-win32.whl
pyqt5-tools @ file:///G:/mytool/pyqt5_tools-5.15.4.3.2-py3-none-any.whl
python-dotenv @ file:///G:/mytool/python_dotenv-0.19.2-py2.py3-none-any.whl
pywin32-ctypes==0.2.0
qt5-applications @ file:///G:/mytool/qt5_applications-5.15.2.2.2-py3-none-win32.whl
qt5-tools==5.15.2.1.2
requests @ file:///G:/mytool/requests-2.27.1-py2.py3-none-any.whl
urllib3==1.26.8