软件和更新应用程序无法打开

软件和更新应用程序无法打开

installingPython3.7开始,software-properties-gtk无法打开。从终端调用它时,显示以下错误:

ERROR:dbus.proxies:Introspect error on :1.171:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
Traceback (most recent call last):
  File "/usr/bin/software-properties-gtk", line 100, in <module>
    app = SoftwarePropertiesGtk(datadir=options.data_dir, options=options, file=file)
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 173, in __init__
    self.backend.Reload();
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.171 was not provided by any .service files

我正在跑步UBUNTU 18.04。我检查了这篇文章,但所有答案都不起作用。我希望有人遇到这个问题并能解决它。谢谢

编辑:根据要求,这里是命令输出:

#which python; ls -l $(which python); echo =; which python3; ls -l $(which python3)

/usr/bin/python
lrwxrwxrwx 1 root root 24 Nov  4 20:51 /usr/bin/python -> /etc/alternatives/python
=
/usr/bin/python3
lrwxrwxrwx 1 root root 25 Nov  4 20:54 /usr/bin/python3 -> /etc/alternatives/python3

另一个调试请求

#ls -al /usr/bin/ | grep python

lrwxrwxrwx  1 root root           26 Mar 26  2018 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x  1 root root         1056 Apr 16  2018 dh_python2
lrwxrwxrwx  1 root root           29 Mar 26  2018 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx  1 root root           23 Sep 30 15:38 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root root           23 Oct  8 14:12 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx  1 root root           23 Aug 18 08:22 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx  1 root root           31 Oct 25  2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root           26 Mar 26  2018 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx  1 root root            9 Apr 16  2018 python -> python2.7
lrwxrwxrwx  1 root root            9 Apr 16  2018 python2 -> python2.7
-rwxr-xr-x  1 root root      3628976 Sep 30 15:38 python2.7
lrwxrwxrwx  1 root root           25 Nov  6 13:38 python3 -> /etc/alternatives/python3
-rwxr-xr-x  2 root root      4526456 Oct  8 14:12 python3.6
lrwxrwxrwx  1 root root           33 Oct  8 14:12 python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x  2 root root      4526456 Oct  8 14:12 python3.6m
lrwxrwxrwx  1 root root           34 Oct  8 14:12 python3.6m-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x  2 root root      5316432 Aug 18 08:22 python3.7
-rwxr-xr-x  2 root root      5316432 Aug 18 08:22 python3.7m
lrwxrwxrwx  1 root root           16 Oct 25  2018 python3-config -> python3.6-config
lrwxrwxrwx  1 root root           10 Oct 25  2018 python3m -> python3.6m
lrwxrwxrwx  1 root root           17 Oct 25  2018 python3m-config -> python3.6m-config
lrwxrwxrwx  1 root root           29 Apr 16  2018 pyversions -> ../share/python/pyversions.py
lrwxrwxrwx  1 root root           34 Oct  8 14:12 x86_64-linux-gnu-python3.6-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x  1 root root         3283 Oct  8 14:12 x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx  1 root root           33 Oct 25  2018 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.6-config
lrwxrwxrwx  1 root root           34 Oct 25  2018 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.6m-config

#readlink -f /usr/bin/python 

/usr/bin/python2.7

#ls -al /usr/bin/ | grep python3

lrwxrwxrwx  1 root root           29 Mar 26  2018 dh_python3 -> ../share/dh-python/dh_python3
lrwxrwxrwx  1 root root           23 Oct  8 14:12 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx  1 root root           23 Aug 18 08:22 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx  1 root root           31 Oct 25  2018 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root root           25 Nov  6 13:38 python3 -> /etc/alternatives/python3
-rwxr-xr-x  2 root root      4526456 Oct  8 14:12 python3.6
lrwxrwxrwx  1 root root           33 Oct  8 14:12 python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x  2 root root      4526456 Oct  8 14:12 python3.6m
lrwxrwxrwx  1 root root           34 Oct  8 14:12 python3.6m-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x  2 root root      5316432 Aug 18 08:22 python3.7
-rwxr-xr-x  2 root root      5316432 Aug 18 08:22 python3.7m
lrwxrwxrwx  1 root root           16 Oct 25  2018 python3-config -> python3.6-config
lrwxrwxrwx  1 root root           10 Oct 25  2018 python3m -> python3.6m
lrwxrwxrwx  1 root root           17 Oct 25  2018 python3m-config -> python3.6m-config
lrwxrwxrwx  1 root root           34 Oct  8 14:12 x86_64-linux-gnu-python3.6-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x  1 root root         3283 Oct  8 14:12 x86_64-linux-gnu-python3.6m-config
lrwxrwxrwx  1 root root           33 Oct 25  2018 x86_64-linux-gnu-python3-config -> x86_64-linux-gnu-python3.6-config
lrwxrwxrwx  1 root root           34 Oct 25  2018 x86_64-linux-gnu-python3m-config -> x86_64-linux-gnu-python3.6m-config

DBUS服务检查

#systemctl status dbus.service

● dbus.service - D-Bus System Message Bus
   Loaded: loaded (/lib/systemd/system/dbus.service; static; vendor preset: enabled)
   Active: active (running) since Sun 2020-11-08 12:40:49 EET; 1h 22min ago
     Docs: man:dbus-daemon(1)
 Main PID: 763 (dbus-daemon)
    Tasks: 3 (limit: 4915)
   CGroup: /system.slice/dbus.service
           ├─  763 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
           └─13887 /usr/bin/python3 /usr/share/usb-creator/usb-creator-helper

Nov 08 13:51:00 TTS-UBUNTU dbus-daemon[763]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Nov 08 13:51:00 TTS-UBUNTU dbus-daemon[763]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 08 13:52:18 TTS-UBUNTU dbus-daemon[763]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Nov 08 13:52:18 TTS-UBUNTU dbus-daemon[763]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 08 13:52:58 TTS-UBUNTU dbus-daemon[763]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Nov 08 13:52:58 TTS-UBUNTU dbus-daemon[763]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 08 13:57:39 TTS-UBUNTU dbus-daemon[763]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Nov 08 13:57:39 TTS-UBUNTU dbus-daemon[763]: [system] Successfully activated service 'org.freedesktop.hostname1'
Nov 08 13:58:19 TTS-UBUNTU dbus-daemon[763]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service'
Nov 08 13:58:19 TTS-UBUNTU dbus-daemon[763]: [system] Successfully activated service 'org.freedesktop.hostname1'

答案1

sudo update-alternatives  --remove-all python3

来自手册页

删除所有替代方案及其所有相关的从属链接。名称是替代方案目录中的名称(在您的情况下为 python3)

sudo rm /usr/bin/python3

然后创建一个新链接。

sudo ln -s /usr/bin/python3.6  /usr/bin/python3

答案2

我也遇到了同样的问题。
我照做了sudo update-alternatives --config python3,并切换到python 3.6

python 版本变化

祝你好运 !!!

相关内容