gpt4 book ai didi

python - 如何从 Python 3.7 docker 镜像运行 SSL_library_init()

转载 作者:太空宇宙 更新时间:2023-11-03 20:14:12 25 4
gpt4 key购买 nike

直到最近,我一直在 python:3.6.6-jessie docker 镜像中使用 openssl 库,并且事情按预期工作。

我使用非常基本的 Dockerfile 配置来安装所有必要的依赖项:

FROM python:3.6.6-jessie
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /code

RUN apt-get -qq update
RUN apt-get install openssl
RUN apt-get upgrade -y openssl
ADD requirements.txt /code/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt

并使用以下两行访问并初始化库本身:

openssl = cdll.LoadLibrary("libssl.so")
openssl.SSL_library_init()

这种方法效果很好。

<小时/>

本周我正在升级 python 和库,因此我切换到更新的 docker 镜像:

FROM python:3.7.5
...

这立即导致 openssl 由于此异常而停止工作:

AttributeError: /usr/lib/x86_64-linux-gnu/libssl.so.1.1: undefined symbol: SSL_library_init

从这个错误中我可以了解到libssl不再提供SSL_library_init方法(或者看起来是这样),这是一个相当奇怪的问题,因为中的初始化程序名称>openssl 文档是相同的。

我还尝试使用 -stretch-buster 发行版解决此问题,但问题仍然存在。

在这些较新的发行版中运行 SSL_library_init 的正确方法是什么?也许需要一些额外的 dockerfile 配置?

最佳答案

我认为你需要安装libssl1.0-dev

RUN apt-get install -y libssl1.0-dev

关于python - 如何从 Python 3.7 docker 镜像运行 SSL_library_init(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58563651/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com