溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何解決ImportError: 'pyOpenSSL' module missing required functionality的問題

發(fā)布時間:2021-10-14 09:52:25 來源:億速云 閱讀:214 作者:iii 欄目:編程語言

這篇文章主要講解了“如何解決ImportError: 'pyOpenSSL' module missing required functionality的問題”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“如何解決ImportError: 'pyOpenSSL' module missing required functionality的問題”吧!

問題描述

執(zhí)行 certbot renew 產(chǎn)生如下錯誤:

# 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 中,或者其他發(fā)行版,我們可以通過 pip 安裝 Python 模塊,也可以使用 yum 源安裝 Python 模塊。

也就說,問題可能有兩種原因:
1)同個包即通過 yum 安裝,也通過 pip 安裝,最后導(dǎo)致沖突
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的問題”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對如何解決ImportError: 'pyOpenSSL' module missing required functionality的問題這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI