下载get-pip.py文件后
用python get-pip.py 安装报以下错误:
pip is configured with locations that require TLS/SSL, however the ssl
module in Python is not available. Collecting xxx Could not fetch
URL https://pypi.python.org/simple/xxxx/: There was a problem
confirming the ssl certificate: Can’t connect to HTTPS URL because the
SSL module is not available. - skipping Could not find a version that
satisfies the requirement xxx (from versions: ) No matching
distribution found for xxx
执行python ,进入python 命令行:
import ssl
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/python27/lib/python2.7/ssl.py”, line 60, in
import _ssl # if we can’t import it, let the error propagate
ImportError: No module named _ssl
查看是否安装openssl 和 openssl-devel
[xxx@xxx ~]# rpm -aq|grep openssl
openssl-x.x.xe-x.xxx
openssl-devel-xxx-xxx
如果没有安装就重新安装下这两个包,如果已经安装,重新编译下python
重新编译python
修改Setup文件
vim /{python源码目录}/Python-2.x.x/Modules/Setup
找到下面这几行,把注释去掉。
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
重新执行
make
make install
这时进入python 命令行, import ssl 就可以正常使用了。
python get-pip.py也不会报上面的错误了
http://blog.youkuaiyun.com/qq_25560423/article/details/62055497
https://github.com/pypa/pip