使用 virtualenv 加密 Amazon Linux 时出现错误

使用 virtualenv 加密 Amazon Linux 时出现错误

我下载了 certbot-auto 并运行

./certbot-auto certonly --standalone -d domain.com -m [email protected] --agree-tos -n --debug

我收到以下错误,它正在寻找 virtualenv==15.1.0,但安装的版本是 16.0.0。是否可以让 certbot-auto 使用版本 16.0.0?我该怎么做才能解决此错误。

Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3049, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3033, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3062, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 660, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 673, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 858, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'virtualenv==15.1.0' distribution was not found and is required by the application

   $ virtualenv --version
    16.0.0

答案1

我一直在寻找这个确切的问题。我终于找到了答案。首先,进入/usr/bin并删除名为 的文件virtualenv*

然后,使用以下命令安装虚拟机:

sudo /usr/bin/easy_install virtualenv

从那时起,certbot 就可以完美运行了。

答案2

只需卸载并再次安装 virtualenv 即可,对我来说有效。

pip uninstall virtualenv

pip install virtualenv

相关内容