_# jeffery # focus on Odoo and other open source IT solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家__Q:913547235 讨论群397750860

解决apt 依赖破损的问题

安装 python3 / python2 共存的环境时, 不知道做了什么, 导致

apt 依赖故障

odoo@sy-odoo-08:~$ sudo apt-get remove apport

正在读取软件包列表... 完成

正在分析软件包的依赖关系树

正在读取状态信息... 完成

下列软件包是自动安装的并且现在不需要了:

gir1.2-glib-2.0 iso-codes libgirepository-1.0-1 python3-apport python3-apt python3-gi

python3-problem-report

使用'sudo apt autoremove'来卸载它(它们)

下列软件包将被【卸载】:

apport

升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 31 个软件包未被升级。

2 个软件包没有被完全安装或卸载。

需要下载 0 B/144 kB 的归档。

解压缩后将会空出 778 kB 的空间。

您希望继续执行吗? [Y/n] y

(正在读取数据库 ... 系统当前共安装有 99960 个文件和目录。)

正在卸载 apport (2.20.1-0ubuntu2.10) ...

Traceback (most recent call last):

File "/usr/bin/pyclean", line 31, in <module>

from debpython import files as dpf

ImportError: No module named debpython

dpkg: 处理软件包 apport (--remove)时出错:

子进程 已安装 pre-removal 脚本 返回错误状态 1

Traceback (most recent call last):

File "/usr/bin/pycompile", line 35, in <module>

from debpython.version import SUPPORTED, debsorted, vrepr, \

ImportError: No module named debpython.version

dpkg:清理时出错:

子进程 已安装 post-installation 脚本 返回错误状态 1

在处理时有错误发生:

apport

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

   

报告

Traceback (most recent call last):

File "/usr/bin/pycompile", line 35, in <module>

from debpython.version import SUPPORTED, debsorted, vrepr, \

ImportError: No module named debpython.version

   

如下图

   

尝试用 apt-get install -f 也无法解决..

   

偶尔运行 apt-get install --reinstall python-mininal , 却发现 这个 破损被修复了.

   

查找 python-mininal 包的 详情, 发现 /usr/bin/pycompile 正好是 它所提供的

   

所以 重装 python-minimal 刚刚好 修复了这个问题.

   

   

   

备注:

python3-minimal 内容跟 python-minimal 不一样

   

总结:

   

python程序报错, 第一步 应该检查 程序本身, 然后, 才是接着 检查 依赖包

本例 应该检查 /usr/bin/pycompile , pycompile 可以在 安装其他版本的python时 被污染, 所以, 重装 包含pycompile 的包 才是正确的做法…..

   

那么 怎么反查 文件包含在哪个 包里面呢?

   

可以用 dpkg -S

dpkg -S /usr/bin/pycompile

   

 

还可以用 apt-file

   

例如, 查找 包含 pycompile 的包

   

   

posted on 2017-11-03 19:14  odoouse  阅读(2583)  评论(0编辑  收藏  举报

导航

_# jeffery # focus on Odoo and other open source IT solutions # IT基础架构资深专家,开源解决方案专家,odoo资深专家