[Centos&Python]python3以及安装pip3出现问题is configured with locations that require TLS/SSL

解决:

python安装完毕后,提示找不到ssl模块:
例如这样:
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

  • 使用rpm -aq|grep openssl 查看是否有openssl-devel存在,不在就需要:
yum install openssl openssl-devel -y 

或者单独编译:
https://blog.csdn.net/m0_38016951/article/details/81195377

  • 之后重新编译Python3的时候需要注意:
    修改Setup文件
    vi /usr/software/Python-2.7.5/Modules/Setup
    修改成下面: 原本有部分是被注释的
# Socket module helper for socket(2)
#_socket socketmodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

# The crypt module is now disabled by default because it breaks builds
# on many systems (where -lcrypt is needed), e.g. Linux (I believe).

重新编译

make 
make install
    原文作者:_小老虎_
    原文地址: https://www.jianshu.com/p/3228466fa8ee
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞