![意外删除了/usr/bin/python3.5,无法重新安装](https://linux22.com/image/997837/%E6%84%8F%E5%A4%96%E5%88%A0%E9%99%A4%E4%BA%86%2Fusr%2Fbin%2Fpython3.5%EF%BC%8C%E6%97%A0%E6%B3%95%E9%87%8D%E6%96%B0%E5%AE%89%E8%A3%85.png)
操作系统:Ubuntu 14.04
我见过类似问题,但那里提到的方法都不起作用。
我通过运行以下命令安装了 Python 3.5:
apt-get install -y software-properties-common && \
add-apt-repository ppa:fkrull/deadsnakes && \
apt-get update
apt-get install -y python3.5 python3.5-dev
我运行时出错ln -sf /usr/bin/python /usr/bin/python3.5
,因此符号链接python3.5
变成python2.7
。
我努力了:
1.
rm -f /etc/apt/sources.list.d/*
dpkg --configure -a
add-apt-repository ppa:fkrull/deadsnakes
apt-get update
apt-get install --reinstall python3.5 python3.5-dev
2.
apt-get remove --purge python3.5 python3.5-dev
apt-get install python3.5 python3.5-dev
在这两种情况下我都得到了类似这样的信息:
/var/lib/dpkg/info/python3.5.postinst: 9: /var/lib/dpkg/info/python3.5.postinst: python3.5: not found
dpkg: error processing package python3.5 (--configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of python3.5-dev:
python3.5-dev depends on python3.5 (= 3.5.2-1~trusty1); however:
Package python3.5 is not configured yet.
dpkg: error processing package python3.5-dev (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python3.5
python3.5-dev
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
我修好了它。
查找所有依赖项:
dpkg -l | grep python3.5
删除所有:
apt-get --purge remove libpython3.5 libpython3.5-dev libpython3.5-minimal libpython3.5-stdlib python3.5 python3.5-dev python3.5-minimal
重新安装
apt-get install python3.5-dev