执行 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