Ubuntu python 配置或 dpkg: 清理时出错:

Ubuntu python 配置或 dpkg: 清理时出错:

一周以来我无法在我的机器上安装任何东西,当我想更新 apt 时也遇到错误,提前致谢。

sudo apt update(与 sudo apt update 相同):

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2196 kB]
Fetched 2532 kB in 2s (1349 kB/s)
/usr/lib/cnf-update-db: 3: import: not found
/usr/lib/cnf-update-db: 4: import: not found
/usr/lib/cnf-update-db: 5: import: not found
/usr/lib/cnf-update-db: 6: import: not found
from: can't read /var/mail/CommandNotFound.db.creator
from: can't read /var/mail/CommandNotFound
/usr/lib/cnf-update-db: 14: Syntax error: word unexpected (expecting ")")
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

sudo apt install -f

...
/usr/bin/py3clean: 26: import: not found
from: can't read /var/mail/glob
from: can't read /var/mail/os
from: can't read /var/mail/os.path
/usr/bin/py3clean: 31: Syntax error: word unexpected (expecting ")")
dpkg: warning: old python3-pil:amd64 package pre-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/usr/bin/py3clean: 24: import: not found

/usr/bin/py3compile: 33: Syntax error: word unexpected (expecting ")")
dpkg: error while cleaning up:
 installed python3-pil:amd64 package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/python3-pil_7.0.0-4ubuntu0.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

例如,当我想安装 binwalk 时

sudo apt install binwalk

Reading package lists... Done
Building dependency tree
Reading state information... Done
binwalk is already the newest version (2.2.0+dfsg1-1).
The following packages were automatically installed and are no longer required:
  aircrack-ng hwloc ieee-data liblua5.2-0 libsbc1 libsmi2ldbl libspandsp2 libspeexdsp1 libssh-gcrypt-4
  libwireshark-data libwireshark13 libwiretap10 libwsutil11 net-tools pixiewps reaver rfkill tshark wireshark-common
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  python-pil-doc python3-pil-dbg
The following packages will be upgraded:
  python3-pil
1 upgraded, 0 newly installed, 0 to remove and 36 not upgraded.
11 not fully installed or removed.
Need to get 0 B/414 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 87359 files and directories currently installed.)
Preparing to unpack .../python3-pil_7.0.0-4ubuntu0.6_amd64.deb ...
/usr/bin/py3clean: 24: import: not found
/usr/bin/py3clean: 25: import: not found
/usr/bin/py3clean: 26: import: not found
from: can't read /var/mail/glob
from: can't read /var/mail/os
from: can't read /var/mail/os.path
/usr/bin/py3clean: 31: Syntax error: word unexpected (expecting ")")
dpkg: warning: old python3-pil:amd64 package pre-removal script subprocess returned error exit status 2
dpkg: trying script from the new package instead ...
/usr/bin/py3clean: 24: import: not found
/usr/bin/py3clean: 25: import: not found
/usr/bin/py3clean: 26: import: not found
from: can't read /var/mail/glob
from: can't read /var/mail/os
from: can't read /var/mail/os.path
/usr/bin/py3clean: 31: Syntax error: word unexpected (expecting ")")
dpkg: error processing archive /var/cache/apt/archives/python3-pil_7.0.0-4ubuntu0.6_amd64.deb (--unpack):
 new python3-pil:amd64 package pre-removal script subprocess returned error exit status 2
/usr/bin/py3compile: 25: import: not found
/usr/bin/py3compile: 26: import: not found
/usr/bin/py3compile: 27: import: not found
/usr/bin/py3compile: 28: import: not found
/usr/bin/py3compile: 29: import: not found
from: can't read /var/mail/os
from: can't read /var/mail/os.path
from: can't read /var/mail/subprocess
/usr/bin/py3compile: 33: Syntax error: word unexpected (expecting ")")
dpkg: error while cleaning up:
 installed python3-pil:amd64 package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/python3-pil_7.0.0-4ubuntu0.6_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试了在互联网上找到的所有我认为可以解决我的问题的方法,但没有任何效果: sudo apt clean sudo dpkg --configure -a

...
dpkg: error processing package muon (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
/sbin/ldconfig.real: /usr/lib/wsl/lib/libcuda.so.1 is not a symbolic link

Errors were encountered while processing:
 python3
 python3-pil:amd64
 python3-xapian
 python3-pip
 apt-xapian-index
 software-properties-qt
 muon

相关内容