欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > 解决_ssl.so: cannot open shared object file: No such file or directory

解决_ssl.so: cannot open shared object file: No such file or directory

2025/2/11 3:28:28 来源:https://blog.csdn.net/dqchouyang/article/details/145505350  浏览:    关键词:解决_ssl.so: cannot open shared object file: No such file or directory

背景:
我在CentOS8.2的操作系统里安装完python2.7后,源码安装了OpenSSL_1_1_1-stable
下载地址:
https://github.com/openssl/openssl/tree/OpenSSL_1_1_1-stable

现象:
结果python导入ssl的时候报错了,报找不到_ssl.so这个库文件

>>> import ssl
Traceback (most recent call last):File "<stdin>", line 1, in <module>File "/usr/local/lib/python2.7/ssl.py", line 60, in <module>import _ssl             # if we can't import it, let the error propagate
ImportError: /usr/local/lib/python2.7/lib-dynload/_ssl.so: cannot open shared object file: No such file or directory

分析:
_ssl.so这个库文件找不到,是因为安装完OpenSSL_1_1_1-stable后,要再安装一次python,并且编译命令如:

./configure --with-ssl-default-suites=openssl --with-ensurepip=install
make altinstall

python 编译完成之后,才会在python2.7/lib-dynload 的目录下生成 _ssl.so 文件。这样再import就没问题了。

解决:
我不去手动编译了,全用yum 命令来吧。

yum install openssl-1:1.1.1k openssl-devel-1:1.1.1k libssl-dev
yum install python27>>> import ssl  # 成功了

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com