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

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

我在 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)

谁能帮我这个?

@Nodak 的答案的输出:

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

希望这有帮助,

津宾斯克

因此,请尝试仅安装 Python,而不是特定版本 3.4。可能存在依赖项未正确安装的问题。因此,只需运行

sudo apt-get install python

并告诉我结果。

希望这可以帮助,

津宾斯克

答案2

这是一个谜。
我删除了/usr/lib/python3.4然后我sudo apt-get purge -f python3

(如果您尝试这样做,您可能需要一个软件包列表,以重新安装那些依赖于 Python3 并随后被 apt-get magic 删除的软件包。

如何操作的说明

然后我去重新安装 python3 sudo apt-get install -f python3。失败了。

sudo apt-get -f install已发布并安装了许多软件包。

重新发布sudo apt-get install -f python3成功恢复目录usr/lib/python3.4和 Python 3 功能。

我重新安装了因附带损害而丢失的软件包。

相关内容