查找需要安装的包
pip search <包名>
安装python包
pip install
pip install <包名>==1.0.4
pip install -r requirements.txt
pip install <包名> -i http://pypi.mirrors.ustc.edu.cn/simple/
pip install -e < local project path> (这个命令相当于pip install develop)
阿里源:http://mirrors.aliyun.com/pypi/simple/
科大源:http://pypi.mirrors.ustc.edu.cn/simple/
清华源:http://mirrors.tuna.tsinghua.edu.cn/pypi/simple
官方源:https://pypi.python.org/
在配置文件中指定安装源
直接在配置文件中添加源,如果没有配置文件可以手动添加一个
/etc/pip.conf
[global]
timeout = 6000
index-url = http://pypi.douban.com/simple
列出已经安装的包
pip list
pip freeze
列出本地可以editable的项目
pip list -e
列出过期的包
pip list -o
升级包
pip install <包名> -U
安装的包所在目录
pip show -f <包名>
pip show
卸载安装
Uninstall packages.
pip is able to uninstall most installed packages. Known exceptions are:
Pure distutils packages installed with python setup.py install, which leave behind no metadata to >determine what files were installed.
Script wrappers installed by python setup.py develop.
pip also performs an automatic uninstall of an old version of a package before upgrading to a newer version.pip uninstall <包名>
pip uninstall -y -r requirement.txt
references: https://pip.pypa.io/en/latest/