当我想用sublime文本编辑器运行(command + B)任何代码时,我得到以下错误:
[WinError 2] Das System kann die angegebene Datei nicht finden
[cmd: ['py', '-u', 'C:\\Users\\XXX\\Documents\\coding\\pygame\\spaceinvaders\\main.py']]
[dir: C:\Users\Leander\Documents\coding\pygame\spaceinvaders]
[path: C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\WINDOWS\System32\OpenSSH\;C:\Users\Leander\AppData\Local\Microsoft\WindowsApps;%DASHLANE_DLL_DIR%;;C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.3\bin;]
[Finished]我试过了:
print("hello")得到了同样的结果。当我使用cmd运行它时:
python C:\Users\XXX\Documents\coding\pygame\spaceinvaders\main.py它工作得很好。我确保我在“工具”>“构建系统”中检查了Python,但结果相同...
发布于 2021-07-04 06:23:35
转到Tools -> Build System -> New Build System
将现有代码替换为(新):
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)",
"selector": "source.python"
}按Ctrl + S / Cmd + S将其保存为您想要的任何名称(例如MyCustomBuild.sublime-build - .sublime-build很重要)。现在它已保存,返回到Tools -> Build System -> MyCustomBuild (或您另存为的名称)。如果你仍然有问题,请在评论中告诉我。:)
https://stackoverflow.com/questions/68238458
复制相似问题