ubuntu误删python_意外apt-get删除python后如何恢复

Yeah. I've done this. It was stupid.

I did not know it's going to pull its dependencies with it, only wanted to install python 2 and 3 from scratch (because of this problem: https://askubuntu.com/questions/897355/how-to-change-default-idle-for-python).

Now, I can still use my terminal, checked these answers:

However after running sudo apt-get install ubuntu-desktop I get these errors:

Setting up python-ldb (2:1.1.24-1ubuntu3) ...

/var/lib/dpkg/info/python-ldb.postinst: 6: /var/lib/dpkg/info/python-ldb.postinst: pycompile: not found

dpkg: error processing package python-ldb (--configure):

subprocess installed post-installation script returned error exit status 127

No apport report written because MaxReports is reached already

Setting up python-tdb (1.3.8-2) ...

/var/lib/dpkg/info/python-tdb.postinst: 6: /var/lib/dpkg/info/python-tdb.postinst: pycompile: not found

dpkg: error processing package python-tdb (--configure):

subprocess installed post-installation script returned error exit status 127

No apport report written because MaxReports is reached already

dpkg: dependency problems prevent configuration of python-samba:

python-samba depends on python-crypto; however:

Package python-crypto is not configured yet.

python-samba depends on python-ldb (>= 1.1.2~); however:

Package python-ldb is not configured yet.

python-samba depends on python-tdb; however:

Package python-tdb is not configured yet.

dpkg: error processing package python-samba (--configure):

dependency problems - leaving unconfigured

No apport report written because MaxReports is reached already

Processing triggers for libc-bin (2.23-0ubuntu7) ...

Errors were encountered while processing:

mercurial-common

python-crypto

python-dnspython

python-ldb

python-tdb

python-samba

E: Sub-process /usr/bin/dpkg returned an error code (1)

Every apt-get install command throws this.

Is there a way to restore these dependencies?

解决方案

Hallelujah.

sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv

sudo apt-get install --reinstall python-dnspython

sudo apt autoremove

sudo apt-get -f install

After a whole day of adventures in the deepest pits of internet, these commands worked for me.

python-dnspython and samba was still missing after the first command, --reinstall python-dnspython pulled samba in as well. Autoremove removed the needless dependencies.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值