centos6.8安装python3.7.3报错Can't connect to HTTPS URL because the SSL module is not available问题解决

环境:CentOS release 6.8 (Final)

# 直接编译python3.7在使用pip3安装依赖的时候报错:

Can‘t connect to HTTPS URL because the SSL module is not available.

解决方法:

1.编译安装OpenSSL 1.0.2j版本并重新配置环境变量

下载OpenSSL源码包:
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz

解压缩,编译安装:
tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config --prefix=/usr/local/lab/openssl-1.0.2j shared zlib
make && make install

2.编译安装Python3,使用自定义的OpenSSL

下载Python3.7.3源码包:

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

解压缩,编译安装:

tar -zxvf Python-3.7.3.tgz
cd Python-3.7.3
./configure --prefix=/usr/local/python373

在这一步之后,先不要着急运行make命令。先修改源码目录 Python-3.7.3/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/lab/openssl-1.0.2j/    #取消这一行的注释,并将原来的/usr/local/ssl改为我们新安装的openssl目录:/usr/local/lab/openssl-1.0.2j/
_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).

#_crypt _cryptmodule.c # -lcrypt    # crypt(3); needs -lcrypt on some systems

修改完成以后,还需要创建两个指向动态链接库的软链接文件:
ln -s /usr/local/lab/openssl-1.0.2j/lib/libssl.so.1.0.0 /usr/lib64/libssl.so.1.0.0
ln -s /usr/local/lab/openssl-1.0.2j/lib/libcrypto.so.1.0.0 /usr/lib64/libcrypto.so.1.0.0

最后编译并安装:
make && make install

# 创建软连接
ln -s /usr/local/python373/bin/pip3 /usr/local/bin/pip3
ln -s /usr/local/python373/bin/python3 /usr/local/bin/python3

# 安装软件继续报错:
[[email protected]:/usr/local]# pip3 install requests
Collecting requests
/usr/local/python373/bin/python3.7: symbol lookup error: /usr/local/python373/bin/python3.7: undefined symbol: SSL_CTX_get0_param

# 找了各自资料发现都无法解决这个问题,问题很可能就出在openssl上

undefined symbol: SSL_CTX_get0_param 这个函数就是zlib源码中的函数,于是重新编译openssl

1.清理之前安装的openssl
rm -rf /usr/local/src/openssl-1.0.2j    # 清理源码
rm -rf /usr/local/lab/openssl-1.0.2j    # 清理安装程序

tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
# 修改编译参数,no-zlib 不需要zlib
./config --prefix=/usr/local/lab/openssl-1.0.2j no-zlib
make && make install

2.重新编译安装Python3.7.3

# 清理源码目录和已经按照的目录
rm -rf /usr/local/src/Python-3.7.3
rm -rf /usr/local/python373

# 再次解压编译安装
tar -zxvf Python-3.7.3.tgz
cd Python-3.7.3
./configure --prefix=/usr/local/python373

在这一步之后,先不要着急运行make命令,先修改源码目录 Python-3.7.3/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/lab/openssl-1.0.2j/    #取消这一行的注释,并将原来的/usr/local/ssl改为我们新安装的openssl目录:/usr/local/lab/openssl-1.0.2j/
_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).

#_crypt _cryptmodule.c # -lcrypt    # crypt(3); needs -lcrypt on some systems

最后编译并安装:
make && make install

# 再次pip3安装依赖就不会报错了
[[email protected]:/usr/local/src/Python-3.7.3]# pip3 install requests
Collecting requests
  Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
    100% |████████████████████████████████| 61kB 14.1MB/s
Collecting certifi>=2017.4.17 (from requests)
  Downloading https://files.pythonhosted.org/packages/69/1b/b853c7a9d4f6a6d00749e94eb6f3a041e342a885b87340b79c1ef73e3a78/certifi-2019.6.16-py2.py3-none-any.whl (157kB)
    100% |████████████████████████████████| 163kB 23.3MB/s
Collecting idna<2.9,>=2.5 (from requests)
  Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 19.8MB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests)
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 23.9MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)
  Downloading https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl (150kB)
    100% |████████████████████████████████| 153kB 24.8MB/s
Installing collected packages: certifi, idna, chardet, urllib3, requests
Successfully installed certifi-2019.6.16 chardet-3.0.4 idna-2.8 requests-2.22.0 urllib3-1.25.3

centos6.8安装python3.7.3报错Can't connect to HTTPS URL because the SSL module is not available问题解决

原文地址:https://www.cnblogs.com/reblue520/p/11103311.html

时间: 2024-10-19 22:01:48

centos6.8安装python3.7.3报错Can't connect to HTTPS URL because the SSL module is not available问题解决的相关文章

安装Python3.6.2报错:zipimport.ZipImportError: can&#39;t decompress data; zlib not available

解决方法: 1.安装依赖zlib.zlib-devel 2.重新编译安装Python ./configure 重新编译安装:make & make install 安装Python3.6.2报错:zipimport.ZipImportError: can't decompress data; zlib not available

Centos6.5安装 scipy sciki-learn 一堆报错

最近给业务线安装python的扩展numpy,scripy,scikit-learn时,遇到了一堆报错,也走了一些弯路,费了好长时间,最好发现竟然是一个很简单的问题. 系统环境:Centos 6.5 Python: 2.7 pip install numpy 很顺利,没有报错 pip install scipy 一堆报错,报错大致如下 Installing scipy on redhat with error "no lapack/blas resources found" 然后就开始

centos6.5安装mysql5.6.23报错

参考链接:http://blog.csdn.net/wendi_0506/article/details/39478369 注意:ftp需要二进制下载源码包,不然会导致解压失败 安装后启动: 参考:http://blog.sina.com.cn/s/blog_637e04c9010117ri.html [email protected] mysql]# /etc/rc.d/init.d/mysql statusMySQL is not running, but lock file (/var/l

centos6.5 安装 xtables-addons 过程及报错解决

Windows下使用pip安装python包是报错-UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte 0xcb in position 0

先交待下开发环境: 操作系统:Windows 7 Python版本:2.7.9 Pip版本:6.1.1 其他环境忽略 在windows下使用pip下载python包,出现如下错误 [plain] view plain copy Collecting xxxxxx Exception: Traceback (most recent call last): File "D:\Python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\basecommand.

安装mongodb后启动报错libstdc++

安装mongo后启动报错如下图 显然说是libstdc++.so文件版本的问题,这种一般都是gcc版本太低了 接着查询gcc的版本    strings /usr/lib/libstdc++.so.6 | grep GLIBCXX 接着去找下libstdc++.so新点的版本,一定要根据自己的系统版本去找啊,由于我找错了版本报错系统位数不对 随后下载了一个64位的libstdc++.so.6.0.17的文件,然后软链成libstdc++.so.6 ln -s libstdc++.so.6.0.1

DELL 755行业用机安装windows 2003系统报错 0x0000007b

DELL 755行业用机用光盘安装windows 2003系统报错:0x0000007b 先放解决办法:将ACHI模式调整为ATA模式即可解决问题: 经过查阅网上资料,最终锁定如下帖子中说的有点道理, http://www.elecfans.com/jiadian/diannao/20121016292687.html [第三参考]安装widows XP时蓝屏代码0X0000007B的问题的解决方案用户在重新安装Windows XP的过程中,可能会出现安装过程中蓝屏,代码是0X0000007B的

Linux下安装Nrpe软件相关报错

Linux下面安装nrpe软件时,如果进行配置时(./configure)  报错: 并且执行make all命令进行编译时候也报错: 解决办法:    在报错的服务器上执行yum -y install openssl-devel   命令安装ssl的库 之后再次执行./configure命令进行配置,如果配置成功应该显示如下信息: 再次使用make all 命令就不会报错了.make all完毕显示如下信息: Linux下安装Nrpe软件相关报错,布布扣,bubuko.com

一招解决OpenERP8.0安装旧版模块报错

有喜欢尝鲜的网友开始玩8.0了,可是版本还没发布,社区的很多特别好的模块还没有升级到8,所以经常碰到模块无法安装的问题. No module name osv 网友提出将模块的 from osv import osv,fields 改为 from openerp.osv import osv,fields 其实这是一个编程规范问题,旧版模块代码里很多这种导入方式,一个一个改对于不懂代码的或者openerp新手是不现实的. 众所周知,openerp的运行入口是openerp-server.py,在