linux和mac 上 pip 不支持ssl的问题

报错:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.


新版的pip 默认要求使用https源了,

pip 的源可以使用国内的源,下载速度会很快。

参考这个 http://mirrors.aliyun.com/help/pypi

pip.conf中要有trusted-host,就可以不用https了。同时也可以解决你的问题。


在~/.pip/pip.conf文件中添加或修改

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/  #可以手工指定是http的或者https的 

[install]
trusted-host=mirrors.aliyun.com

如果是连接pypi.python.org的话配置如下

1
2
3
4
[ global ]
index - url  =  http: / / pypi.python.org / simple /
[install]
trusted - host = pypi.python.org


阿里云的速度要远远高于python官方的速度


另外可以安装一下pyopenssl试试

pip install pyopenssl

pip源配置文件可以放置的位置:

Linux/Unix:

/etc/pip.con

~/.pip/pip.conf  (每一个我都找了都没有,所以我是在这个文件夹中创建的pip.conf文件)

~/.config/pip/pip.conf 


Mac OSX:

~/Library/Application Support/pip/pip.conf

~/.pip/pip.conf

/Library/Application Support/pip/pip.conf 


Windows:

%APPDATA%\pip\pip.ini

%HOME%\pip\pip.ini

C:\Documents and Settings\All Users\Application Data\PyPA\pip\pip.conf (Windows XP)

C:\ProgramData\PyPA\pip\pip.conf (Windows 7及以后) 



猜你喜欢

转载自blog.csdn.net/mergerly/article/details/80395651