2

我需要运行 Software Sources GUI(不,我的工作无法通过apt或完成aptitude)。因为如果我从启动器导航窗口永远不会加载,我决定看看如果我从命令行运行它会发生什么:

jason@jason-mint:~$ software-sources 
  File "/usr/lib/linuxmint/mintSources/mintSources.py", line 48
    def async(func):
            ^
SyntaxError: invalid syntax

文件中的函数mintSources.py如下所示:

# Used as a decorator to run things in the background
def async(func):
    def wrapper(*args, **kwargs):
        thread = threading.Thread(target=func, args=args, kwargs=kwargs)
        thread.daemon = True
        thread.start()
        return thread
    return wrapper

在最顶部,shebang 说:#!/usr/bin/python3. 由于我的默认 Python 是 Python 2.7,因此我将 shebang 更改#!/usr/bin/python为看看会发生什么,只是这次出现了一个新错误:

jason@jason-mint:/etc/apt$ software-sources 
Traceback (most recent call last):
  File "/usr/lib/linuxmint/mintSources/mintSources.py", line 6, in <module>
    import configparser
ImportError: No module named configparser

这意味着它失败了import configparser,这显然表明 python2.7(我的默认值)将无法正常工作。为了澄清,我有Python2Python3 可用:

jason@jason-mint:~$ python --version
Python 2.7.16
jason@jason-mint:~$ python2
Python 2.7.16 (default, Apr  6 2019, 01:42:57) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
jason@jason-mint:~$ python3
Python 3.7.3rc1 (default, Mar 13 2019, 11:01:15) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
jason@jason-mint:~$ python
Python 2.7.16 (default, Apr  6 2019, 01:42:57) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

如果有帮助,请提供一些系统信息:

jason@jason-mint:~$ cat /etc/debian_version 
buster/sid
jason@jason-mint:~$ uname -r
4.19.0-4-amd64
4

0 回答 0