python3.7.5出现ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory

    技术2022-07-12  67

    安装openssl第三方库https://www.openssl.org/docs/manmaster/man3/X509_check_host.html

    报错1: ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory

    解决办法:

    在make && make install 出现如下错误:

    报错2:编译openssl失败(SLES11.3), undefined reference to `OPENSSL_cpuid_setup'

    https://stackoverflow.com/questions/11381514/undefined-reference-when-compiling-openssl

    I ran into the same problem, and was able to solve it by passing adding -DOPENSSL_PIC to the config call:

    解决办法:

    ./config -fPIC -DOPENSSL_PIC

    转载于:https://www.cnblogs.com/erhu-67786482/p/8618909.html

    报错3:

    编译安装openssl报错:POD document had syntax errors at /usr/bin/pod2man line 69. make: *** [install_docs]

    错误如下:

    1

    2

    3

    4

    5

    6

    7

    cms.pod around line 457: Expected text after =item, not a number

    cms.pod around line 461: Expected text after =item, not a number

    cms.pod around line 465: Expected text after =item, not a number

    cms.pod around line 470: Expected text after =item, not a number

    cms.pod around line 474: Expected text after =item, not a number

    POD document had syntax errors at /usr/bin/pod2man line 69.

    make: *** [install_docs] Error 1

    解决方法: 

    执行:

    rm -f /usr/bin/pod2man

    重新编译安装即可。

     

     

     

     

     

    不行就参考:https://www.jianshu.com/p/d403f5bbc58e和https://www.jianshu.com/p/3789d688e6c0

    ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory

     

    yum -y install gcc automake autoconf libtool make wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1e.tar.gz mv openssl-1.0.1e.tar.gz /opt/software/ tar -vaxf /opt/software/openssl-1.0.1e.tar.gz -C /opt/module/ cd /opt/module/openssl-1.0.1e/ ./config --prefix=/usr/local --openssldir=/usr/local/ssl make && make install ./config shared --prefix=/usr/local --openssldir=/usr/local/ssl make clean make && make install cp libssl.so.1.0.0 libcrypto.so.1.0.0 /usr/lib64

     

     

    centos7:python3.7 缺少_ssl模块问题

     

        在centos7上安装python3.7,很多时候提示缺少安装_ssl模块,这导致很多依赖于ssl的模块无法正常安装,如ulib3,requests。

    百度网上也提供很多方法,诸如安装liber.ssl来解决。经过一番探索后,个人总结如下:

    (1)、python3.7的_ssl模块依赖openssl 1.0.2或者1.1以上版本,如果openssl版本低于以上版本,将无法正常安装python3.7 的ssl模块,提示:Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().

    解决方法:

        1、通过yum update 方式更新openssl。这种方式优点是实现简单,缺点是前提需要配置公网yum源,通过公网yum源来实现更新,对于无网络的服务器来说比较麻烦。

        2、通过下载源码进行编译。这种方式比较适合于内网,也不会有依赖问题。

                (a)、官网下载:https://www.openssl.org/source/

                (b)、解压后执行编译安装:./config --prefix=/opt/openssl-1.0.2q/ --openssldir=/opt/openssl-1.0.2q/openssl && make && make install

    (2)、python3.7的_sshl模块需要调用ssl.h函数头,如果操作系统缺少安装openssl-devel软件包,如果是通过yum或者rpm包安装方式的,则需要安装或者更新openssl-devel软件包。如果是通过源码编译实现的,则在源码编译安装时已提供了,无需再安装。

    (3)、openssl的路径设置,这个很重要。

        1、在python3.7的configure源码安装中,在configure文件需要指定openssl的路径,即配置with-openssl(即./configure  --prefix=/opt/python-3.7.1 --with-openssl=/opt/openssl-1.0.2q),这样python的configure就可以正常读取openssl的准确版本了。如果不配置则读取的可能是未更新的openssl版本。

        2、如果是通过yum或者rpm安装openssl的,则通过rpm -qa |grep openssl或者软件包名后,执行rpm -ql openssl软件包名获取openssl的路径,最后通过指令ln软连接实现。我是通过如下指令实现的:ln -s /usr/include/openssl  /usr/local/ssl 实现。(个人在测试的时候,发现python编译安装时候,一直读取的ssldirs是"/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr",即使配置了with-openssl,如果没有配置PKG_CONFIG等环境变量,仍然会读取默认的配置,因此需要将openssl的路径通过连接方式链接到/usr/local/ssl目录下)。当满足以上配置后,在python3.7执行./configure  --prefix=/opt/python-3.7.1,即可在configure阶段就可以看到libssl的支持。例如:

     

    Processed: 0.012, SQL: 9