尽管成功构建了Python文件,但Sublime仍然显示错误

时间:2020-02-25 19:23:00

标签: python sublimetext3

当我使用build命令时,Sublime可以很好地运行我的Python文件,但也会产生我无法理解的错误。这里发生了什么?我正在Windows 10 Pro上使用Sublime Text 3。

hello.py

print('hello')

输出(添加换行符以提高可读性)

The system cannot find the path specified.
hello
[Finished in 0.2s with exit code 1]
[shell_cmd: python -u "C:\Users\mmarchese\Desktop\test2.py" ]
[dir: C:\Users\mmarchese\Desktop]
[path:
C:\Program Files\AdoptOpenJDK\jre-13.0.1.9-hotspot\bin;
C:\Python38\Scripts\;
C:\Python38\;
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;
C:\WINDOWS\system32;
C:\WINDOWS;
C:\WINDOWS\System32\Wbem;
C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
C:\WINDOWS\System32\OpenSSH\;
C:\Program Files (x86)\IBM\Client Access\Emulator;
C:\Program Files (x86)\IBM\Client Access\Shared;
C:\Program Files (x86)\IBM\Client Access\;
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;
C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;
C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;
C:\ProgramData\chocolatey\bin;
C:\Program Files\PuTTY\;
C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;
C:\Program Files\Git\cmd;
C:\Program Files\Microsoft VS Code\bin;
C:\Program Files\nodejs\;
C:\Users\mmarchese\AppData\Local\Microsoft\WindowsApps;]

通过Windows命令提示符运行时,这些方法都可以正常工作

  • python hello.py
  • C:\Python38\Python.exe hello.py

Python.sublime-build

{
    "shell_cmd": "python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env": {"PYTHONIOENCODING": "utf-8"},

    "variants":
    [
        {
            "name": "Syntax Check",
            "shell_cmd": "python -m py_compile \"${file}\"",
        }
    ]
}

0 个答案:

没有答案