吾八哥博客

您现在的位置是:首页 > 码农手记 > Python > 正文

Python

Python里pip常用命令简单介绍

吾八哥2017-08-23Python3109

大家都使用要安装某个模块使用pip命令,但实际上pip命令有很多作用的,这里在网上搜集了一篇针对pip命令介绍的内容分享给大家!

查找需要安装的包

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