Debian 服务器无法运行 Certbot

Debian 服务器无法运行 Certbot
root@vps434142:~# certbot 
Traceback (most recent call last):
  File "/usr/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3017, in <module>
    @_call_aside
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3030, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 659, in _build_master
    ws.require(__requires__)
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 967, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 853, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'certbot==0.28.0' distribution was not found and is required by the application

答案1

请注意,您提供的信息非常少,我只是猜测。不过我会尽力帮助您。

根据您的回答(python 3.5),我猜您使用的是 debian stretch 而不是 buster。

我将尝试重新安装 python3 和 certbot,看看是否有帮助:

apt-get update
apt-get upgrade
apt-get install --reinstall python3
apt-get install --reinstall certbot

如果这没有帮助,您可以尝试通过 pip 安装 certbot:

apt-get remove certbot
apt-get install python3-pip
pip3 install certbot

答案2

我在服务器上安装了 Python 2.7 + 3.5,然后我为某个项目安装了 Python 3.7,然后出现了像你一样的错误。然后我编辑了 /usr/bin/certbot 并将第一行更改为#!/usr/bin/python3.5

这对我很有帮助。

想法 - apt 安装 Certbot 和 python3-certbot 安装包为 3.5,但实际版本 python3 是 python3.7 而不是 3.5

相关内容