Python 3.4 缺少 _ssl.pyd

标签 python ssl python-3.4 ubuntu-10.04 tls1.2

环境: Ubuntu 10.04.4 长期支持版 Python 3.4.3

我有一个可以在 Windows 上完美运行的 python 3.4 Flask HTTPS 服务器。我需要将它转移到现有的 Ubuntu 10.04.4 LTS 服务器上。我在那里构建了 python 3.4,没有任何问题,但是当我运行我的 web 服务器时,它失败并出现错误:

Traceback (most recent call last):
  File "./server.py", line 3, in <module>
    from app import create_app
  File "/opt/license-server/app/__init__.py", line 10, in <module>
    from config import config
  File "/opt/license-server/config.py", line 9, in <module>
    class Config:
  File "/opt/license-server/config.py", line 25, in Config
    LDAP_TLS_VERSION = ssl.PROTOCOL_TLSv1_2
AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv1_2'

我在 Windows 上使用 pyCharm 进行了一些挖掘,以了解发生了什么,似乎 PROTOCOL_TLSv1_2 是在 _ssl.py 中定义的,我相信它来自 _ssl.pyd。 _ssl.py 或 _ssl.pyd 都不存在于 Ubuntu python 安装中,这让我相信我在编译时缺少某些选项或某些东西,但我在 python 网站上找不到任何关于缺少的内容或如何引用的引用获取 TLS-1.2 内容。

谁能指出我正确的方向?

最佳答案

当您从源代码构建 Python 3.4 时,在构建结束时您会收到一份报告,说明哪些模块未构建。我敢打赌 ssl 模块没有构建,因为你的 Ubuntu 安装没有安装 SSL 包。尝试:

sudo apt-get install libssl-dev openssl

然后尝试重建您的 Python 3.4 并查看是否构建了 SSL 模块。

关于Python 3.4 缺少 _ssl.pyd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33519987/

相关文章:

python - 飞行数据集的准确性非常低

python - Keras 预测一个数字,如果在一个范围内则通过

ruby-on-rails - 为什么 Rails ActionMailer 6.1/Ruby 3.0 不忽略自签名 SMTP 证书?

python - 如何区分子字符串和确切的单词?

Python 搜索列表最有效的方法

ios - AFNetworking 1.x 的 SSL 固定

ssl - 如何在同一端口上提供 tcp/ssl 支持

python - multiprocessing.Process 在哪里

python - 如何打印以及如何解释 python 错误消息

python - Installing Python3.4.3 : 3 tests failed, 修改执行环境3个,跳过25个