首页 > 编程语言 >Python3.8.4 解决 ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' m

Python3.8.4 解决 ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' m

时间:2024-04-25 15:24:48浏览次数:26  
标签:1.0 1.1 2r local urllib3 OpenSSL hankyoon root python3.8

系统版本:

CentOS Linux release 7.6.1810 (Core)

编译安装Python3.8.4

[root@hankyoon ~]# tar -xvf Python-3.8.4.tgz

[root@hankyoon ~]# cd Python-3.8.4/

[root@hankyoon ~]# ./configure --prefix=/usr/local/python3.8

[root@hankyoon ~]# make && make install

[root@hankyoon ~]# echo "PATH=/usr/local/mysql/bin:/usr/local/python3.8/bin/:$PATH" >> /etc/profile

[root@hankyoon ~]# source /etc/profile

安装requests、pymysql

[root@hankyoon ~]# pip3.8 install requests -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

[root@hankyoon ~]# pip3.8 install pymysql -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

执行MySQL备份脚本:

[root@hankyoon ~]# /usr/local/python3.8/bin/python3.8 /data/db_tools/scripts/db_mysql_bak.py

报错:

Traceback (most recent call last):
  File "/data/db_tools/scripts/db_mysql_bak.py", line 6, in <module>
    import requests
  File "/usr/local/python3.8/lib/python3.8/site-packages/requests/__init__.py", line 43, in <module>
    import urllib3
  File "/usr/local/python3.8/lib/python3.8/site-packages/urllib3/__init__.py", line 42, in <module>
    raise ImportError(
ImportError: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips  26 Jan 2017'. See: https://github.com/urllib3/urllib3/issues/2168

安装openssl-1.0.2r

[root@hankyoon ~]# wget http://www.openssl.org/source/openssl-1.0.2r.tar.gz

[root@hankyoon ~]# tar zxvf openssl-1.0.2r.tar.gz

[root@hankyoon ~]# ./config --prefix=/opt/openssl1.0.2r --openssldir=/opt/openssl1.0.2r/openssl no-zlib

[root@hankyoon ~]# make && make install

[root@hankyoon ~]# echo "/opt/openssl1.0.2r/lib" >> /etc/ld.so.conf

[root@hankyoon ~]# ldconfig -v

[root@hankyoon ~]# cd Python-3.8.4

[root@hankyoon ~]# vim Modules/Setup
SSL=/opt/openssl1.0.2r
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

重新编译Python-3.8.4
[root@hankyoon ~]# cd Python-3.8.4

[root@hankyoon ~]# make && make Install

重新执行MySQL备份脚本,若还报错,将urllib3版本降低

[root@hankyoon ~]# python3.8 -m pip install urllib3==1.26.6

 

标签:1.0,1.1,2r,local,urllib3,OpenSSL,hankyoon,root,python3.8
From: https://www.cnblogs.com/hankyoon/p/18157787

相关文章

  • 汉得PI&PO教材-Adapter使用-实例3 rfc2soap V1.0
    汉得PI&PO教材系列   Adapter使用-实例3:RFC2SOAP         仅限汉得内部使用 作者:张版本:1.0日期:2019-12-18图标 图标含义 警告 示例 注释 建议 语法 外部处理......
  • 汉得PI&PO教材-Adapter使用-实例4 proxy2proxy V1.0
    汉得PI&PO教材系列   Adapter使用-实例4:proxy2proxy         仅限汉得内部使用 作者:徐伟版本:1.0日期:2017-02-28图标 图标含义 警告 示例 注释 建议 语法 外部处......
  • 汉得PI&PO教材-Adapter使用-实例6 proxy2jdbc(异步)V1.0
    汉得PI&PO教材系列   汉得PI&PO教材-Adapter使用-实例6proxy2jdbc(异步)         仅限汉得内部使用 作者:汉得顾问版本:1.0日期:2017-02-01图标 图标含义 警告 示例 注释 建议......
  • 汉得PI&PO教材-Adapter使用-实例5 jdbc2jdbc(含存错过程)V1.0
    汉得PI&PO教材系列   Adapter使用-实例5jdbc2jdbc(含存错过程)         仅限汉得内部使用 作者:汉得顾问版本:1.0日期:2017-02-01图标 图标含义 警告 示例 注释 建议 语法......
  • 汉得PI&PO教材-Adapter使用-实例8 rfc2rest V1.0
    汉得PI&PO教材系列   Adapter使用-实例8:RFC2Rest         仅限汉得内部使用 作者:黄照家版本:1.0日期:2017-02-25图标 图标含义 警告 示例 注释 建议 语法 外部处......
  • 汉得PI&PO教材-Adapter使用-实例7 rest2rfc V1.0
    汉得PI&PO教材系列   Adapter使用-实例7:Rest2RFC         仅限汉得内部使用 作者:黄照家版本:1.0日期:2017-02-25图标 图标含义 警告 示例 注释 建议 语法 外部处......
  • 汉得PI&PO教材-Adapter使用-实例1 file2file V1.0
    汉得PI&PO教材系列   Adapter使用-实例1:File2File         仅限汉得内部使用 作者:汉得顾问版本:1.0日期:2017-02-01图标 图标含义 警告 示例 注释 建议 语法 外部......
  • 汉得PI&PO教材-Adapter使用-实例2 soap2rfc V1.0
    汉得PI&PO教材系列   Adapter使用-实例2:SOAP2RFC         仅限汉得内部使用 作者:戴瑞亭版本:1.0日期:2017-03-01图标 图标含义 警告 示例 注释 建议 语法 外部处......
  • golang工具函数,把一个金额整型,单位为分,转成"1,231,111.00"格式的字符串
    这个函数首先将整数除以100来获取代表元的浮点数,然后格式化此数值为两位小数的字符串。接下来,函数将字符串分成整数和小数部分,并且为整数部分添加千位分隔符。最后,如果存在小数部分,它会将这两部分重新组合并返回正确格式化的金额字符串。为了正确地处理负数,我们需要先检查金额是......
  • shell脚本一键安装nginx-1.18.0
    shell脚本一键安装nginx-1.18.0#!/bin/bashset-euopipefailNGINX_VERSION="1.18.0"DOWNLOAD_URL="https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz"INSTALL_DIR="/apps/nginx"PACKAGE_LIST="gccpcre-developenssl-develz......