我没有多想自己在做什么,就删除了 bin / python3 文件夹。
现在我所有的事情都遇到了问题。
我无法安装任何东西。我尝试了太多不同的方法试图找到解决方案,但一无所获。
例如,当我尝试执行 sudo apt install software-properties-common 时,我得到:
....
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-dbus (--configure):
installed python3-dbus package post-installation script subprocess returned error exit sta
tus 3
Setting up python3-apt (2.0.0ubuntu0.20.04.6) ...
E: py3compile:243: Requested versions are not installed
....
dpkg: error processing package python3-distro-info (--configure):
installed python3-distro-info package post-installation script subprocess returned error e
xit status 3
dpkg: dependency problems prevent configuration of python3-requests-unixsocket:
python3-requests-unixsocket depends on python3-requests; however:
Package python3-requests is not configured yet.
python3-requests-unixsocket depends on python3-urllib3; however:
Package python3-urllib3 is not configured yet.
dpkg: error processing package python3-requests-unixsocket (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3-dbus
python3-apt
software-properties-common
python3-six
unattended-upgrades
python3-chardet
python3-software-properties
python3-certifi
python3-gi
python3-requests
python3-idna
python-setuptools
python3-pip
python3-urllib3
python3-minimal
python-dnspython
python3-distro-info
python3-requests-unixsocket
当我尝试做
sudo apt download python3* unattended-upgrades && sudo dpkg -i --force-all ./*.deb
我得到唯一的输出:
E: Unable to locate package python3-minimal_3.8.2-0ubuntu2_amd64.deb
我有 Ubuntu 20.04
除了从 bin 中删除 python 之外,我还接触了 .bashrc 文件。
我的终端和桌面工作正常
sudo apt-f 安装
...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-dbus (--configure):
installed python3-dbus package post-installation script subprocess returned err
or exit status 3
Setting up python3-apt (2.0.0ubuntu0.20.04.6) ...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-apt (--configure):
installed python3-apt package post-installation script subprocess returned erro
r exit status 3
dpkg: dependency problems prevent configuration of software-properties-common:
software-properties-common depends on python3-dbus; however:
Package python3-dbus is not configured yet.
dpkg: error processing package software-properties-common (--configure):
dependency problems - leaving unconfigured
Setting up python3-six (1.14.0-2) ...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-six (--configure):
installed python3-six package post-installation script subprocess returned erro
r exit status 3
dpkg: dependency problems prevent configuration of unattended-upgrades:
unattended-upgrades depends on python3-apt (>= 1.9.6~); however:
Package python3-apt is not configured yet.
unattended-upgrades depends on python3-dbus; however:
Package python3-dbus is not configured yet.
...
dpkg: error processing package python3-requests-unixsocket (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3-dbus
python3-apt
software-properties-common
python3-six
unattended-upgrades
python3-chardet
python3-software-properties
python3-certifi
python3-gi
python3-requests
python3-idna
python-setuptools
python3-pip
python3-urllib3
python3-minimal
python-dnspython
python3-distro-info
python3-requests-unixsocket
E: Sub-process /usr/bin/dpkg returned an error code (1)
如果我尝试安装 python 我会得到:
Setting up python3-minimal (3.8.2-0ubuntu2) ...
E: py3compile:243: Requested versions are not installed
dpkg: error processing package python3-minimal (--configure):
installed python3-minimal package post-installation script subprocess returned error exit status 3
Errors were encountered while processing:
python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt 更新
Hit:1 http://es.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://es.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://es.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://ppa.launchpad.net/blaze/rtbth-dkms/ubuntu focal InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
在会议开始时我得到:
bash: pyenv: command not found
答案1
从评论和其他答案来看,
第一个 OP.bashrc
使用以下方法恢复了文件这个问题。
首先备份旧文件:
cp ~/.bashrc ~/.bashrc.bak
复制文件的框架版本
cp /etc/skel/.bashrc ~/
加载新文件:
source ~/.bashrc
之后 OP 运行:
mkdir xyz && sudo mv /var/lib/dpkg/info/python3* ~/xyz
sudo mv /var/lib/dpkg/info/unattended-upgrades* ~/xyz && sudo mv /var/lib/dpkg/info/software-properties-common* ~/xyz
然后他们跑了:
sudo cp -r /var/lib/dpkg/status $HOME
echo > /var/lib/dpkg/status
最后他们跑了:
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -f