所以我最近进入了python,我使用sublime text 2很多东西,比如HTML和CSS,我也想在python中使用它,但是当我试图用它编译时,我得到了以下错误:
[Error 2] The system cannot find the file specified
[cmd: [u'python', u'-u', u'C:\\Users\\User\\AppData\\Roaming\\Sublime Text 2\\Projects\\All Python Coding stuff\\Sublime Testing.py']]
[dir: C:\Users\User\AppData\Roaming\Sublime Text 2\Projects\All Python Coding stuff]
[path: C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Panda Security\WaAgent\Common;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.7.0_51\bin]
[Finished]
我已经将构建系统更改为python,并且重新启动,甚至再次安装python。当我在IDLE中运行python脚本时,它工作得很好。
编辑1。
所以现在我得到了错误:
[Error 2] The system cannot find the file specified
[cmd: [u'python', u'-u', u'C:\\Users\\Weber\\AppData\\Roaming\\Sublime Text 2\\Projects\\All Python Coding stuff\\Sublime Testing.py']]
[dir: C:\Users\Weber\AppData\Roaming\Sublime Text 2\Projects\All Python Coding stuff]
[path: /usr/local/bin]
[Finished]
我的“python.sublime build”如下所示:
{
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}
您需要将python目录添加到系统的path环境变量中。 要在windows中执行此操作,需要转到“控制面板”>;“系统和安全”>;“系统”>;“高级系统设置”>;在“高级”选项卡中,转到“环境变量”。在“系统变量”区域的“环境变量”中向下滚动,直到找到路径。选择它并按编辑。然后会出现一个标题为“编辑系统变量”的窗口,其中包含变量名(应为路径)和变量值(长字符串)。在字符串的开头,您需要手动添加python的目录。例如,我的python 2.7目录位于*C:\ Python27*处,因此需要在字符串的开头添加C:\ Python27'。在你这样做之后,这个值现在应该是这样的:
C:\Python27\;C:\Program Files
等。。试着告诉我们结果:)
希望有帮助
干杯, 亚历克斯
之所以会出现这种情况,是因为cmd从“C:\ Users\YOU”开始。你必须“说出”完整的路径。我将args“-u”和我的文件的url直接发送到python.exe。
试试看:
Obs:我正在使用Python2.7,它的可执行文件在C:\ Python27\文件夹中。
相关问题 更多 >
编程相关推荐