让我们加密certbot auto失败,因为Python/pip问题

2024-06-08 01:27:38 发布

您现在位置:Python中文网/ 问答频道 /正文

昨天一切都很好,但今天,使用certbot auto运行相同的命令来续订证书,我得到了以下消息:

Upgrading certbot-auto 0.31.0 to 0.32.0...
Replacing certbot-auto...
Creating virtual environment...
Installing Python packages...    
/opt/eff.org/certbot/venv/bin/python: No module named pip.__main__; 'pip' is a package and cannot be directly executed
    Traceback (most recent call last):
      File "/tmp/tmp.eUWQ3w7cFV/pipstrap.py", line 177, in <module>
        sys.exit(main())
      File "/tmp/tmp.eUWQ3w7cFV/pipstrap.py", line 149, in main
        pip_version = StrictVersion(check_output([python, '-m', 'pip', '--version'])
      File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['/opt/eff.org/certbot/venv/bin/python', '-m', 'pip', '--version']' returned non-zero exit status 1

我在Debian 7.9。。。有同样问题的人?


Tags: pipinpyorgautooutputvenvmain
2条回答

看起来这是在升级certbot包的过程中发生的?

No module named pip.__main__; 'pip' is a package and cannot be directly executed

这可能是由于Python在找到实际pip模块之前在include路径中遇到了名为pip的文件夹。调试这个有点困难(您需要找出这个上下文中Python的include路径是什么,然后在这些路径中搜索坏文件夹),但是您可以通过删除并重新安装certbot auto包来解决这个问题。

(你的Debian版本很古老,但certbot版本不是,它使用virtualenv作为依赖项,所以可能不是这样。)

在Ubuntu12.04和Debian7.5上的最新版本(>;=0.32.x)有问题。

只需克隆上一个分支(我使用了0.30.x):

git clone --branch 0.30.x https://github.com/letsencrypt/letsencrypt

运行letsencrypt时使用--no-self-upgrade选项。就我而言:

./letsencrypt-auto certonly --no-self-upgrade --standalone -d mydomain.com

不要忘记将--no-self-upgrade添加到续订cron作业中。

相关问题 更多 >

    热门问题