gpt4 book ai didi

python - 在 Sublime Text 2 中设置 Python IDE 时出现问题。错误 : [Error 2] The system cannot find the file specified

转载 作者:太空宇宙 更新时间:2023-11-04 08:07:58 25 4
gpt4 key购买 nike

我想在 Sublime Text 2 中设置一个完整的 Python IDE。我在 Stack Overflow 上发现了以下看起来很有帮助的线程:

How do I run Python code from Sublime Text 2?

Running python in Sublime Text 2 getting error

问题

但我遵循了这些步骤,但它仍然对我不起作用。我将我的文件命名为 Test2 并将其保存到我的下载文件夹中。然后我输入了一行简单的代码

print 'test'

然后返回了这个错误

[Error 2] The system cannot find the file specified
[cmd: [u'python', u'-u', u'C:\\Users\\Stan Shunpike\\Downloads\\Test2.py']]
[dir: C:\Users\Stan Shunpike\Downloads]
[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\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 (x86)\nodejs\;C:\Program Files (x86)\Elm Platform\0.14\bin;C:\Users\Stan Shunpike\AppData\Roaming\npm]
[Finished]

问题

为什么这不起作用?我可以采取什么步骤来解决这个问题,以便我可以使用 Python 进行编码?

备注:

这些线程看起来相关,但它们没有专门讨论我的问题:

Sublime Text 2 Ant Build Target: [Error 2] The system cannot find the file specified

Can't resolve WindowsError: [Error 2] The system cannot find the file specified

备注:

这个帖子看起来很有用

How to run code in Sublime text 2 python

但我不知道编辑“sublime build”是什么意思,特别是因为我还没有成功地在 Sublime 中编写任何代码,而且在我看来线程正在要求我输入要执行的代码。

编辑 1:

我已经修改了环境变量路径,但是我没有重启 Sublime。所以在 MattDMo 建议我这样做。当我重新启动它时,我得到了以下错误:

  File "C:\Users\Stan Shunpike\Downloads\Test2.py", line 1
print "test"
^
SyntaxError: invalid syntax
[Finished in 0.1s with exit code 1]

最佳答案

您的 PATH 中没有您的 Python 可执行文件的路径,因此 Sublime 无法找到 python。将 C:\Python27(如果这是安装 Python 的位置)添加到您的 PATH 环境变量,然后重新启动 Sublime 并重试。

关于python - 在 Sublime Text 2 中设置 Python IDE 时出现问题。错误 : [Error 2] The system cannot find the file specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27866370/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com