我正在设置我的网站以通过 certbot 使用 https。
我正在按照这里的说明进行操作
我运行wget和chmod没有问题,但是当我执行时:
./certbot-auto
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Setting up gyp (0.1+20150913git1f374df9-1ubuntu1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package gyp (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-virtualenv (15.0.1+ds-3) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package python-virtualenv (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of node-gyp:
node-gyp depends on gyp (>= 0.1+20150913git1f374df9); however:
Package gyp is not configured yet.
dpkg: error processing package node-gyp (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of npm:
npm depends on node-gyp (>= 0.10.9); however:
Package node-gyp is not configured yet.
dpkg: error processing package npm (--configure):
dependency problems - leaving unconfigured
Setting up trash-cli (0.12.9.14-2) ...
Run Code Online (Sandbox Code Playgroud)
我主要关注错误:
导入错误:没有名为“ConfigParser”的模块
但找不到任何解决方案。
我该如何解决这个错误?
ps 我想知道这是否与不同的默认 python 设置有关,但 ived 使用 ln -sf /usr/bin/python2.7 /usr/local/bin/python 尝试了 2.7 和 3.5 都无济于事。
小智 4
首先,按照之前的答案中的建议删除 Python 3 是一个糟糕的主意,虽然它有很小的机会解决您的特定问题,但它更有可能创建更多问题,因为任何依赖它的程序都会崩溃。
其次,您的问题源于对系统进行的不应该进行的修改。python旨在python2默认链接到(请参阅PEP 394python-minimal )以实现向后兼容性,并由Ubuntu提供(请参阅文件列表)。
我建议删除损坏的软件包,重新安装,并python运行python-minimal以下内容:python3python3-minimal
sudo apt update # Get an up-to-date list of available packages
sudo apt autoclean # Remove partial packages
sudo apt clean # Remove package cache to force redownload
sudo apt install --reinstall python python-minimal python3 python3-minimal
Run Code Online (Sandbox Code Playgroud)
如果任何损坏的包拒绝通过删除apt,您可以使用sudo dpkg --remove -force --force-remove-reinstreq $BROKEN_PACKAGE_NAMES(当然您应该用实际损坏的包替换变量)。请注意,这几乎会卸载任何内容,因此不要尝试卸载您认为对系统至关重要的软件包。
修复系统 Python 后,certbot-auto再次运行。
| 归档时间: |
|
| 查看次数: |
1971 次 |
| 最近记录: |