./python:加载共享库时出错:libssl.so.1.1:无法打开共享库文件:没有这样的文件或目录 [英] ./python: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

查看:1038
本文介绍了./python:加载共享库时出错:libssl.so.1.1:无法打开共享库文件:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Ubuntu 16.04中尝试使用带有openssl-1.1.1的python 3.7. python和openssl版本都是预发行版本.在上一篇文章中按照以下说明如何将openssl链接到python ,我下载了 opnssl-1.1.1 的源代码. 然后导航到openssl的源代码并执行:

I need to try python 3.7 with openssl-1.1.1 in Ubuntu 16.04. Both python and openssl versions are pre-release. Following instructions on how to statistically link openssl to python in a previous post, I downloaded the source for opnssl-1.1.1. Then navigate to the source code for openssl and execute:

./config
sudo make
sudo make install

然后,编辑Modules/Setup.dist以取消注释以下行:

Then, edit Modules/Setup.dist to uncomment the following lines:

SSL=/usr/local/ssl
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

然后下载 python 3.7 源代码.然后,在源代码中导航并执行:

Then download python 3.7 source code. Then, navigate inside the source code and execute:

./configure
make
make install

执行make install后,在终端输出的末尾出现此错误:

After I execute make install I got this error at the end of the terminal output:

./python: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory
generate-posix-vars failed
Makefile:596: recipe for target 'pybuilddir.txt' failed
make: *** [pybuilddir.txt] Error 1

我无法弄清楚问题出在哪里,我需要做什么.

I could not figure out what is the problem and what I need to do.

推荐答案

这与(应该)与 Python OpenSSL 版本无关.

This has (should have) nothing to do with Python or OpenSSL versions.

Python 构建过程,包括启动新解释器时的一些步骤,并尝试加载一些新构建的模块-包括 extension 模块(已编写)在 C 中,实际上是共享对象( .so )).

Python build process, includes some steps when the newly built interpreter is launched, and attempts to load some of the newly built modules - including extension modules (which are written in C and are actually shared objects (.so)).

加载 .so 时,加载器必须(递归)找到 .so 所需的所有 .so 文件(取决于上),否则它将无法加载.

When an .so is loaded, the loader must find (recursively) all the .so files that the .so needs (depends on), otherwise it won't be able to load it.

Python 有一些依赖于 OpenSSL _ssl * .so _hashlib * .so ) >库.由于您是根据 OpenSSL 1.1.1 构建的(库名称与系统默认的名称不同:通常为 1.0.* > ),则加载程序将无法使用默认的加载程序.

Python has some modules (e.g. _ssl*.so, _hashlib*.so) that depend on OpenSSL libs. Since you built yours against OpenSSL1.1.1 (the lib names differ from what comes by default on the system: typically 1.0.*), the loader won't be able to use the default ones.

您需要做的是指示加载程序在哪里寻找您的" OpenSSL 库(位于/usr/local/ssl/lib 下). .一种方法是在 $ {LD_LIBRARY_PATH} env var中添加其路径(在构建 Python 之前):

What you need to do, is instruct the loader where to look for "your" OpenSSL libs (which are located under /usr/local/ssl/lib). One way of doing that is adding their path in ${LD_LIBRARY_PATH} env var (before building Python):

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/ssl/lib
./configure
make
make install

检查 [SO]:如何为使用Python打包的libcrypto和libssl启用FIPS模式? (@CristiFati的答案),以获取与您的远程相关的更广泛问题的详细信息.

Check [SO]: How to enable FIPS mode for libcrypto and libssl packaged with Python? (@CristiFati's answer) for details on a wider problem remotely related to yours.

这篇关于./python:加载共享库时出错:libssl.so.1.1:无法打开共享库文件:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆