centos 安装pip 报错

来源:转载

下载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

[[email protected] ~]# rpm -aq|grep openssl openssl-x.x.xe-x.xxxopenssl-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.csdn.net/qq_25560423/article/details/62055497
https://github.com/pypa/pip

分享给朋友:
您可能感兴趣的文章:
随机阅读: