更新 20.04 时出现问题 - python3.7 错误

Jef*_*ins 11 apt python3 20.04

我只是尝试运行正常的更新/升级并收到此错误:

dpkg: warning: files list file for package 'libpython3.7-minimal:amd64' missing; assuming package has no files currently installed
(Reading database ... 141307 files and directories currently installed.)
Preparing to unpack .../libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb ...
Unpacking libpython3.7-stdlib:amd64 (3.7.13-1+focal3) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.13-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

我尝试用谷歌搜索并查看此处,但我发现的最新解决方案不起作用。尝试运行损坏修复会导致:

dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.7/distutils/__init__.py', which is also in package python3.7-distutils 3.7.13-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.7-stdlib_3.7.13-1+focal3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Run Code Online (Sandbox Code Playgroud)

小智 17

我通过删除 python3.7 及其库并在之后重新安装来修复它。

这对我有用:

sudo dpkg --remove --force-remove-reinstreq python3.7 
sudo dpkg --remove --force-remove-reinstreq libpython3.7-stdlib 
sudo apt-get clean 
sudo apt-get autoremove 
sudo apt-get install python3.7
Run Code Online (Sandbox Code Playgroud)