Python Certbot 模块 'collections' 没有属性 'Mapping'

Python Certbot module 'collections' has no attribute 'Mapping'

当我在 Linux Ubuntu Server 20.04.3 LTS 的控制台中尝试 运行 certbot 时,出现以下错误:

Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.40.0', 'console_scripts', 'certbot')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/certbot/main.py", line 18, in <module>
    from certbot import cert_manager
  File "/usr/lib/python3/dist-packages/certbot/cert_manager.py", line 15, in <module>
    from certbot import ocsp
  File "/usr/lib/python3/dist-packages/certbot/ocsp.py", line 25, in <module>
    from certbot.storage import RenewableCert # pylint: disable=unused-import
  File "/usr/lib/python3/dist-packages/certbot/storage.py", line 15, in <module>
    from certbot import cli
  File "/usr/lib/python3/dist-packages/certbot/cli.py", line 33, in <module>
    from certbot.plugins import disco as plugins_disco
  File "/usr/lib/python3/dist-packages/certbot/plugins/disco.py", line 183, in <module>
    class PluginsRegistry(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'

我已经搜索了解决方案,但没有找到。即使有相同错误的帖子也无法解决我的问题。奇怪的是,它在大约两个月前就起作用了。

我 运行宁 Python 3.10.

就我而言,我编辑了文件 /usr/bin/certbot 并将 #!/usr/bin/python3 更改为: #!/usr/bin/python3.8 因为 Certbot 尚不支持 Python 3.10