意外删除了/usr/lib/python3.4

分享于 

8分钟阅读

ubuntu

  繁體

问题

我在ubuntu 14.04上意外删除了python3.4

我尝试


apt-get install python3.4


dpkg-reconfigure -a


apt-get install -f



看到下列错误


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


 dependency problems - leaving unconfigured


Errors were encountered while processing:


 python3.4-minimal


 python3-minimal


 python3.4


 python3


 python3-pkg-resources


 python-chardet-whl


 python-pip-whl


 python3-chardet


 python3-colorama


 python3.4-dev


 python3-dev


 python3-distlib


 python3-six


 python3-html5lib


 python3-urllib3


 python3-requests


 python3-setuptools


 python3-pip


 python3-wheel


 dh-python


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



我还尝试使用完全删除python3.4


apt-get remove --purge python3.4



,并重新安装。但它给我以下错误


Rebuilding /usr/share/applications/bamf-2.index...


Setting up python3.4-minimal (3.4.3-1ubuntu1~14.04.3) ...


Could not find platform independent libraries <prefix>


Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]


Fatal Python error: Py_Initialize: Unable to get the locale encoding


ImportError: No module named 'encodings'


Aborted


dpkg: error processing package python3.4-minimal (--configure):


 subprocess installed post-installation script returned error exit status 134


dpkg: dependency problems prevent configuration of python3.4:


 python3.4 depends on python3.4-minimal (= 3.4.3-1ubuntu1~14.04.3); however:


 Package python3.4-minimal is not configured yet.



dpkg: error processing package python3.4 (--configure):


 dependency problems - leaving unconfigured


Errors were encountered while processing:


 python3.4-minimal


 python3.4


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



谁能帮助我?


Rebuilding /usr/share/applications/bamf-2.index...


Setting up python3.4-minimal (3.4.3-1ubuntu1~14.04.3) ...


Could not find platform independent libraries <prefix>


Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]


Fatal Python error: Py_Initialize: Unable to get the locale encoding


ImportError: No module named 'encodings'


Aborted


dpkg: error processing package python3.4-minimal (--configure):


 subprocess installed post-installation script returned error exit status 134


dpkg: dependency problems prevent configuration of python3.4:


 python3.4 depends on python3.4-minimal (= 3.4.3-1ubuntu1~14.04.3); however:


 Package python3.4-minimal is not configured yet.



dpkg: error processing package python3.4 (--configure):


 dependency problems - leaving unconfigured


dpkg: dependency problems prevent configuration of python3-minimal:


 python3-minimal depends on python3.4-minimal (>= 3.4.0-0~); however:


 Package python3.4-minimal is not configured yet.



dpkg: error processing package python3-minimal (--configure):


 dependency problems - leaving unconfigured


dpkg: dependency problems prevent configuration of python3:


 python3 depends on python3.4 (>= 3.4.0-0~); however:


 Package python3.4 is not configured yet.


 python3 depends on python3-minimal (= 3.4.0-0ubuntu2); however:


 Package python3-minimal is not configured yet.



dpkg: error processing package python3 (--configure):


 dependency problems - leaving unconfigured


dpkg: dependency problems prevent configuration of dh-python:


 dh-python depends on python3:any (>= 3.3.2-2~); however:


 Package python3 is not configured yet.



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


 dependency problems - leaving unconfigured


Errors were encountered while processing:


 python3.4-minimal


 python3.4


 python3-minimal


 python3


 dh-python


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



这是我运行dpkg-reconfigure -a时的输出


dpkg-reconfigure -a


acpid stop/waiting


acpid start/running, process 26874


avahi-daemon stop/waiting


avahi-daemon start/running, process 27149


Rebuilding /usr/share/applications/bamf-2.index...


update-alternatives: using /usr/share/man/man7/bash-builtins.7.gz to provide /usr/share/man/man7/builtins.7.gz (builtins.7.gz) in auto mode


update-initramfs: deferring update (trigger activated)


cgroup-lite stop/waiting


cgroup-lite start/running


/var/lib/dpkg/info/compiz.config: 1: /var/lib/dpkg/info/compiz.config: [general]: not found


/var/lib/dpkg/info/compiz.config: 2: /var/lib/dpkg/info/compiz.config: backend: not found


/var/lib/dpkg/info/compiz.config: 3: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found


/var/lib/dpkg/info/compiz.config: 5: /var/lib/dpkg/info/compiz.config: [gnome_session]: not found


/var/lib/dpkg/info/compiz.config: 6: /var/lib/dpkg/info/compiz.config: backend: not found


/var/lib/dpkg/info/compiz.config: 7: /var/lib/dpkg/info/compiz.config: integration: not found


/var/lib/dpkg/info/compiz.config: 8: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found


/var/lib/dpkg/info/compiz.config: 9: /var/lib/dpkg/info/compiz.config: profile: not found


/var/lib/dpkg/info/compiz.config: 11: /var/lib/dpkg/info/compiz.config: [general_ubuntu]: not found


/var/lib/dpkg/info/compiz.config: 12: /var/lib/dpkg/info/compiz.config: backend: not found


/var/lib/dpkg/info/compiz.config: 13: /var/lib/dpkg/info/compiz.config: integration: not found


/var/lib/dpkg/info/compiz.config: 14: /var/lib/dpkg/info/compiz.config: plugin_list_autosort: not found


/var/lib/dpkg/info/compiz.config: 15: /var/lib/dpkg/info/compiz.config: profile: not found




答案1

尝试完全卸载python


sudo apt-get remove --purge python3.4



这将删除与python一起安装的所有依赖

然后运行以下命令再次安装python


sudo apt-get install python3.4



sudo apt-get install python


答案2

我删除了/usr/lib/python3.4sudo apt-get purge -f python3

sudo apt-get install -f python3 失败了。

sudo apt-get -f install

sudo apt-get install -f python3 成功还原目录usr/lib/python3.4和python 3功能。



acc  DEL  APT  
相关文章