我正在运行 centos 6,我最近尝试安装 python 3,可能弄乱了与 python 相关的一些问题
如果我做
python2 /usr/local/bin/certbot-auto renew
我明白了
file "/usr/local/bin/certbot-auto", line 20 if [ -z "$HOME" ]; then ^
SyntaxError: invalid syntax
如果我做
/usr/local/bin/certbot-auto renew
我明白了
import ssl File "/usr/local/lib/python2.7/ssl.py", line 146, in <module>
import base64 # for DER-to-PEM translation File
"/usr/local/lib/python2.7/base64.py", line 11, in <module> import binascii
ImportError: No module named binascii WARNING: unable to check for
updates. Traceback (most recent call last): File "<stdin>", line 16, in
<module> File "/usr/local/lib/python2.7/distutils/version.py", line 140,
in cmp compare = cmp(self.version, other.version) AttributeError:
StrictVersion instance has no attribute 'version' root@~$
答案1
Certbot 尝试使用 python 2.6 运行,但出现问题,我阅读了 certbot bash 脚本,发现它也可以使用 python 3 运行,因此我使用 python 3 运行它,如下所示
USE_PYTHON_3=1 ./usr/local/bin/certbot-auto renew
问题已解决