安装或者更新
curl https://bootstrap.pypa.io/get-pip.py | python
如果已经安装直接运行命令更新 pip
pip install --upgrade pip
手动指定源
pip install -i http://pypi.douban.com/simple web.py
pipy 国内镜像可以考虑下面几个:
http://mirrors.aliyun.com/pypi/simple
http://pypi.douban.com/ 豆瓣
http://pypi.hustunique.com/ 华中理工大学
http://pypi.sdutlinux.org/ 山东理工大学
http://pypi.mirrors.ustc.edu.cn/ 中国科学技术大学
要配制默认源,需要创建或修改配置文件(linux 的文件在~/.pip/pip.conf,windows 在 %HOMEPATH%\pip\pip.ini):
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
$ pip install SomePackage
$ pip install SomePackage-1.0-py2.py3-none-any.whl
$ pip install relative_path_to_seaborn.tar.gz
$ pip install absolute_path_to_seaborn.tar.gz
$ pip install file:///absolute_path_to_seaborn.tar.gz
$ pip install -r requirements-dev.txt
requirements.txt 文件格式说明:
[[--option]...]
<requirement specifier> [; markers] [[--option]...]
<archive url/path>
[-e] <local project path>
[-e] <vcs project url>
-r <requirements.txt>
如果在requirements.txt中安装的某个包需要指定url,可以这样写:
-i https://xxxx.com/pypi/xxx/simple
tornado
requests
这样在-i之后的包都使用url=https://xxxx.com/pypi/xxx/simple进行
pip install git+git://github.com/miso-belica/sumy.git
pip install git+ssh://git@github.com/goerz/mgplottools.git@master#egg=mgplottools
pip install git+https://github.com/goerz/mgplottools.git@master#egg=mgplottools
pip install git+git://github.com/goerz/mgplottools.git@master#egg=mgplottool
显示需要更新的包:
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
安装更新:
$ pip install --upgrade SomePackage
$ pip install --upgrade SomePackage==version
卸载
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
IndexError:list index out of range
pip install --no-use-wheel --upgrade distribute
pip install --download wheelhouse -r requirements.txt --trusted-host mirror-sng.oa.com
使用 wheelhouse 安装的时候运行下面命令行
pip install -r requirements.txt --no-index --find-links file://`readlink -m ./wheelhouse`
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。