Mac系统 修改 pip 国内源

Mac系统 修改 pip 国内源

找到如下文件,如没有自行创建即可

/Users/你的用户名/Library/Application Support/pip/pip.conf

我当前用的是清华的源,也可以选其他的


[global]
index-url=http://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn


国内pip源


(1)阿里云 http://mirrors.aliyun.com/pypi/simple/

(2)豆瓣http://pypi.douban.com/simple/

(3)清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

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

(5)华中科技大学http://pypi.hustunique.com/


注意:新版ubuntu要求使用https源。


单词 pip 指定源 -i 源

pip3 install -r requirement/requirement-dev.txt -i https://pypi.tuna.tsinghua.edu.cn/simple


window 配置方法 参考:

有两个方法,方法一是一次性的,方法二是永久性的。


方法一:


后面的–trusted-host 是指设置为受信源,否则在安全性较高的连接下是连接不上的


以安装pandas为例


pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn

1

方法二:


在windows文件管理器中,输入 %APPDATA%,然后回车,接下来会进入一个新的路径


在该目录下新建pip文件夹,然后到pip文件夹里面去新建个pip.ini文件



把下边的复制进去(我用的清华的源,如果想配置其他源只需要改下边的内容即可)


[global]

index-url=https://pypi.tuna.tsinghua.edu.cn/simple

truste

————————————————                 

原文链接:https://blog.csdn.net/weixin_44110998/article/details/104042358