温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何解决ImportError: 'pyOpenSSL' module missing required functionality的问题

发布时间:2021-10-14 09:52:25 来源:亿速云 阅读:194 作者:iii 栏目:编程语言

这篇文章主要讲解了“如何解决ImportError: 'pyOpenSSL' module missing required functionality的问题”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何解决ImportError: 'pyOpenSSL' module missing required functionality的问题”吧!

问题描述

执行 certbot renew 产生如下错误:

# certbot renew --renew-hook "docker-compose -f /usr/local/harbor/docker-compose.yml restart"
/usr/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please comment in
https://github.com/pypa/setuptools/issues/1458
about the steps that led to this unsupported combination.
************************************************************
  sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
Traceback (most recent call last):
  File "/usr/bin/certbot", line 9, in <module>
    load_entry_point('certbot==1.0.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2859, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2450, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2456, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/certbot/main.py", line 2, in <module>
    from certbot._internal import main as internal_main
  File "/usr/lib/python2.7/site-packages/certbot/_internal/main.py", line 20, in <module>
    from certbot._internal import client
  File "/usr/lib/python2.7/site-packages/certbot/_internal/client.py", line 14, in <module>
    from acme import client as acme_client
  File "/usr/lib/python2.7/site-packages/acme/client.py", line 37, in <module>
    requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()  # type: ignore
  File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 118, in inject_into_urllib3
    _validate_dependencies_met()
  File "/usr/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 160, in _validate_dependencies_met
    "'pyOpenSSL' module missing required functionality. "
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.

问题原因

在 CenOS 中,或者其他发行版,我们可以通过 pip 安装 Python 模块,也可以使用 yum 源安装 Python 模块。

也就说,问题可能有两种原因:
1)同个包即通过 yum 安装,也通过 pip 安装,最后导致冲突
2)或者某个模块依赖于更新版本的 pyOpenSSL 模块

从日志中看,可能是 urllib3 模块的问题。

解决办法

下面是原文作者给出的解决方案,能够解决我们的问题:

pip uninstall -y requests
yum reinstall -y python-requests
pip uninstall -y six
yum reinstall -y python-six
pip uninstall -y urllib3
yum reinstall -y python-urllib3

感谢各位的阅读,以上就是“如何解决ImportError: 'pyOpenSSL' module missing required functionality的问题”的内容了,经过本文的学习后,相信大家对如何解决ImportError: 'pyOpenSSL' module missing required functionality的问题这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI