
每當我單擊啟動圖標時software and updates
,程式就會啟動然後停止。我什至嘗試從命令行啟動它,同樣的事情發生了。
/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gdk, Gtk, Gio, GLib
/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gdk, Gtk, Gio, GLib
此行為很奇怪,因為命令退出時沒有任何錯誤 ( echo $?
)。還有什麼可能導致它這樣失敗?
奇怪的是,如果我以 root ( gksu software-properties-gtk
) 身份啟動它,它就可以正常工作。
答案1
問題是我作為使用者安裝的 python 版本不包含該程式運行所需的 gtk 庫。
當我以 root 身份運行它時,它使用的是系統的 python 安裝,其中已經內建了所有這些庫,所以它自然就可以工作了。
此問題已在更高版本中修復,software-properties-gtk
因為程式頂部的 shebang 行現在顯示:
#!/usr/bin/python3
代替#!/usr/bin/env python3
。
後者導致它使用用戶自己的 python3 版本,而前者(現在是事實上的)使用系統安裝的 python3 版本