运行软件源会导致Python错误(LMDE 3)

时间:2019-04-14 19:10:30

标签: python debian-based cinnamon

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

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(我的默认设置)将无法工作。为了明确起见,我同时提供了 Python2 Python3:

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

0 个答案:

没有答案