无法在 Linux 上安装最新的 certbot

unable to install latest certbot on Linux

下面是我的Linux版本

root@DKERP:~# uname -a
Linux DKERP 5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

我以 root 用户身份尝试了以下命令,以便安装最新的 certbot。

      246  sudo apt-get update
      247  sudo apt-get install --only-upgrade certbot
      249  wget https://dl.eff.org/certbot-auto
      250  sudo apt-get update -y
      251  sudo apt-get install software-properties-common
      252  sudo add-apt-repository universe
      253  sudo add-apt-repository ppa:certbot/certbot
      254  sudo apt-get update -y
      255  sudo apt-get install certbot python-certbot-nginx
      256  sudo apt-get install certbot python-certbot-apache
      258  sudo apt update
      259  sudo apt install --only-upgrade certbot

但是,当我第一次使用 certbot 命令时出现以下错误

root@DKERP:~# certbot
Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'certbot==0.40.0' distribution was not found and is required by the application

你能推荐一下吗?

您是否尝试使用 Snap 安装它?也许它可以解决问题,因为它似乎与 python 3 个包有冲突:

 sudo snap install certbot --classic