【发布时间】:2021-03-13 20:45:49
【问题描述】:
为什么我在尝试导入 eventlet 的 SSL 模块时收到以下导入错误:
ModuleNotFoundError: No module named 'OpenSSL.tsafe'
eventlet 的 OpenSSL 是否与最新版本的 pyOpenSSL 不兼容?
复制步骤
使用以下 Pipenv:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
[packages]
pyOpenSSL = "*"
eventlet = "*"
[requires]
python_version = "3"
使用该文件创建一个 pipenv:
$ pipenv install
Creating a virtualenv for this project…
Pipfile: /tmp/Pipfile
Using /usr/local/bin/python3.8 (3.8.3) to create virtualenv…
...
Successfully created virtual environment!
...
现在导入 eventlet.green.OpenSSL.SSL:
$ pipenv run python
Python 3.8.3 (default, Jun 29 2020, 18:02:49)
[GCC 8.3.1 20190311 (Red Hat 8.3.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from eventlet.green.OpenSSL import SSL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/myuser/.local/share/virtualenvs/tmp-XVr6zr33/lib/python3.8/site-packages/eventlet/green/OpenSSL/__init__.py", line 3, in <module>
from . import tsafe
File "/home/myuser/.local/share/virtualenvs/tmp-XVr6zr33/lib/python3.8/site-packages/eventlet/green/OpenSSL/tsafe.py", line 1, in <module>
from OpenSSL.tsafe import *
ModuleNotFoundError: No module named 'OpenSSL.tsafe'
>>>
【问题讨论】:
-
嗯。深入研究这些包,我注意到 PyOpenSSL 刚刚创建了一个 20.0.0 版本,它删除了 tsafe.py。也许 eventlet 需要更新?
标签: python-3.x pyopenssl eventlet