【问题标题】:dpkg: error processing archivedpkg:错误处理存档
【发布时间】:2020-06-07 15:12:05
【问题描述】:

尝试在 ubuntu 16.04 上安装任何东西时出现此错误。

SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-
samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
/var/cache/apt/archives/python-libxml2_2.9.3+dfsg1-1ubuntu0.2_amd64.deb
/var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.16.04.6_amd64.deb
N: Ignoring file '50unattended-upgrades.ucf-dist' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过 apt-get -f install 但它显示相同的错误。有人可以帮忙吗?

【问题讨论】:

  • 经过一段时间的搜索,我已经解决了终端中这些行的问题:-
  • sudo apt-get clean
  • sudo apt-get 更新
  • sudo apt-get install --reinstall python-minimal python-lockfile
  • sudo apt-get -f install

标签: linux ubuntu


【解决方案1】:

经过一段时间的搜索,我已经解决了终端中这些行的问题:

 $ sudo apt-get clean
 $ sudo apt-get update
 $ sudo apt-get install --reinstall python-minimal python-lockfile
 $ sudo apt-get -f install

【讨论】:

  • 没有解释,只有几行代码。显然这不起作用。 apt-get update 给出错误,答案包括运行apt-get update。这有什么用?
【解决方案2】:

要解决此问题,请检查您的 Python 版本。

插入命令:

update-alternatives --config python

然后启用 2.7 版本。

现在检查。

【讨论】:

    猜你喜欢
    • 2022-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-20
    • 2023-03-29
    相关资源
    最近更新 更多