大约有几天软件更新程序不会提醒我更新。今天早上我发现software-properties-gtk
系统启动时反复崩溃,如果我尝试从终端启动它,它最终会出现以下回溯:
Traceback (most recent call last):
File "/usr/bin/software-properties-gtk", line 37, in <module>
from softwareproperties.gtk.SoftwarePropertiesGtk import SoftwarePropertiesGtk
File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 54, in <module>
from UbuntuDrivers import detect
File "/usr/lib/python3/dist-packages/UbuntuDrivers/detect.py", line 21, in <module>
system_architecture = apt.apt_pkg.get_architectures()[0]
AttributeError: module 'apt' has no attribute 'apt_pkg'
类似的行为如下update-manager
:
Traceback (most recent call last):
File "/usr/bin/update-manager", line 38, in <module>
from UpdateManager.UpdateManager import UpdateManager
File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 58, in <module>
from .UpdatesAvailable import UpdatesAvailable
File "/usr/lib/python3/dist-packages/UpdateManager/UpdatesAvailable.py", line 61, in <module>
from DistUpgrade.DistUpgradeCache import NotEnoughFreeSpaceError
File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeCache.py", line 109, in <module>
class MyCache(apt.Cache):
AttributeError: module 'apt' has no attribute 'Cache'
因此问题似乎与 Python 模块有关apt
。尽管如此,使用从终端启动的Python 2.7.12
或Python 3.5.2
,我都可以毫无问题地执行这些命令,例如:
>>> import apt
>>> apt.apt_pkg.get_architectures()[0]
'amd64'
我也尝试过重新安装几个apt
/python
相关的 Linux 软件包以及software-properties-gtk
。update-manager
但是,没有成功。
我重新安装的所有软件包的列表(可能):
apt apt-utils aptdaemon aptdaemon-data update-manager update-manager-core software-properties-gtk dbus python-pkg-resources python3-pkg-resources python-apt python3-apt python-aptdaemon python3-aptdaemon python-apt-common python-aptdaemon.gtk3widgets python3-aptdaemon.gtk3widgets python3-aptdaemon.pkcompat libapt-inst2.0 libapt-pkg5.0
幸运的是,该问题仅影响图形界面,即我可以通过、、、apt
...从终端升级、安装或删除 ubuntu 软件包。无论如何,这有点烦人。apt-get
aptitude
更新:
我也尝试过(但没有成功)重新安装所有python3
以前安装的软件包:
sudo apt-get install --reinstall libpeas-1.0-0-python3loader libpython3-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib python3 python3-apport python3-apt python3-aptdaemon python3-aptdaemon.gtk3widgets python3-aptdaemon.pkcompat python3-blinker python3-brlapi python3-bs4 python3-cairo python3-catkin-pkg-modules python3-cffi-backend python3-chardet python3-checkbox-support python3-commandnotfound python3-cryptography python3-cups python3-cupshelpers python3-dateutil python3-dbus python3-dbus.mainloop.qt python3-debian python3-defer python3-distupgrade python3-docutils python3-empy python3-ewmh python3-feedparser python3-gdbm python3-gi python3-gi-cairo python3-guacamole python3-html5lib python3-httplib2 python3-idna python3-jinja2 python3-jwt python3-louis python3-lxml python3-mako python3-markupsafe python3-minimal python3-oauthlib python3-padme python3-pexpect python3-pil python3-pkg-resources python3-plainbox python3-problem-report python3-progressbar python3-ptyprocess python3-pyasn1 python3-pyatspi python3-pycurl python3-pygments python3-pyparsing python3-renderpm python3-reportlab python3-reportlab-accel python3-requests python3-roman python3-ros-buildfarm python3-ros-buildfarm-modules python3-rosdistro-modules python3-rospkg-modules python3-setuptools python3-six python3-software-properties python3-speechd python3-systemd python3-uno python3-update-manager python3-urllib3 python3-xdg python3-xkit python3-xlib python3-xlsxwriter python3-yaml python3.5 python3.5-minimal
答案1
python3-ros-buildfarm
我遇到了同样的问题。这与安装 ROS 包进行预发布测试有关。它安装了一个文件/usr/bin/apt.py
,我推测是该文件导致了此命名冲突。删除此包解决了我的问题。