腾讯云Ubuntu Server 16.04.7 LTS
升级系统到Ubuntu Server 18.04.5 LTS
之后,letsencrypt
证书更新出现异常,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
$ sudo ./letsencrypt-auto Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt: Traceback (most recent call last): File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module> from certbot.main import main File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/main.py", line 2, in <module> from certbot._internal import main as internal_main File "/opt/eff.org/certbot/venv/local/lib/python2.7/site-packages/certbot/_internal/main.py", line 6, in <module> import logging.handlers File "/usr/lib/python2.7/logging/__init__.py", line 26, in <module> import sys, os, time, cStringIO, traceback, warnings, weakref, collections File "/usr/lib/python2.7/weakref.py", line 14, in <module> from _weakref import ( ImportError: cannot import name _remove_dead_weakref |
原因为系统版本变化过大导致以前安装的Python
组件不能适应最新的系统,最简单的方法就是删除之前安装的Python
组件,让letsencrypt
重新安装即可。
1 2 3 4 5 |
$ sudo apt-get install python-pip $ sudo rm -rf /opt/eff.org/ $ sudo ./letsencrypt-auto |
参考链接
Cannot renew certificate “ImportError: cannot import name _remove_dead_weakref”