美文网首页Linux与后台开发归档Python
[Centos&Python]python3以及安装pi

[Centos&Python]python3以及安装pi

作者: _小老虎_ | 来源:发表于2019-01-22 18:08 被阅读8次

解决:

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

相关文章

网友评论

    本文标题:[Centos&Python]python3以及安装pi

    本文链接:https://www.haomeiwen.com/subject/ndsrjqtx.html