码迷,mamicode.com
首页 > 编程语言 > 详细

python-配置pip源

时间:2017-11-07 23:51:40      阅读:285      评论:0      收藏:0      [点我收藏+]

标签:路径   overflow   latest   first   ber   clip   com   武汉   python   

可以配置pip源的路径:
三种形式:
1.Per-user:
UNIX default configuration fileHOME/.config/pip/pip.confmacOHOME/Library/Application Support/pip/pip.conf
HOME/.config/pip/pip.conf(HOME/Library/Application Support/pip/不存在)
Windows:%APPDATA%\pip\pip.ini
legacy per-user configuration file(遗留的per-user配置方式):
UNIX:$HOME/.pip/pip.conf
Windows:%HOME%\pip\pip.ini

2.Inside a virtualenv:
Unix and macOS:$VIRTUAL_ENV/pip.conf
Windows:%VIRTUAL_ENV%\pip.ini

3.Site-wide:
Unix:/etc/pip.conf
MacOS:/Library/Application Support/pip/pip.conf
Windows XP:C:\Documents and Settings\All Users\Application Data\pip\pip.ini
Windows7或之后:C:\ProgramData\pip\pip.ini

系统读取顺序(注意后面会覆盖前面):

1.Firstly the site-wide file is read, then
2.The per-user file is read, and finally
3.The virtualenv-specific file is read.

笔者使用的是windows7,将pip.ini配置在%APPDATA%\pip\下。
如果不清楚%APPDATA%在哪里,可以进入cmd,输入set命令。
如图所示:
技术分享
在%APPDATA%\下创建pip文件夹,在pip文件夹下创建pip.ini文本文件。
技术分享
其中index-url指定的是pip源ip地址
笔者使用的是清华大学源。国内比较好用的源有:
pypi.python.org 官方源
pypi.douban.com 豆瓣源,福州
pypi.hustunique.com 华中科技大学源,武汉
pypi.tuna.tsinghua.edu.cn 清华源,北京

http://pypi.mirrors.ustc.edu.cn/simple/ 中国科学技术大学

不嫌麻烦的话,也可以手动指定源
pip install -i xx(其中xx是指定的源ip地址)

参考网址:
https://pip.pypa.io/en/latest/user_guide/

python-配置pip源

标签:路径   overflow   latest   first   ber   clip   com   武汉   python   

原文地址:http://www.cnblogs.com/kevincong/p/7801906.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!