如何更改构建配置,使cmd指向python解释器的实际位置?

时间:2022-12-15 20:44:50

When I try to run python or any language through Sublime Text 2, all it says is

当我试图通过卓越的文本2来运行python或任何语言时,它说的就是。

[Error 2] The system cannot find the file specified
[cmd:  [u'python', u'-u', u'C:\\Users\\Owner\\Desktop\\RandomStuff\\python\\java\\bob.java']]
[dir:  C:\Users\Owner\Desktop\RandomStuff\python\java]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.7.0_03\bin]
[Finished]

I was told to change my build configuration so that the command prompt goes to the python interpreter, but changing the path environment variable does absolutely nothing except add

我被告知要更改我的构建配置,以便命令提示符进入python解释器,但是改变path环境变量除了添加之外什么都不做。

;C:\Python27\python

to the list. This is really frustrating because I am trying to make a game in Python and I have no idea how to fix this.

到列表中。这真的很让人沮丧,因为我正在尝试用Python做游戏,我不知道如何解决这个问题。

3 个解决方案

#1


3  

The path is a list of directories, not files. You should add c:\Python27 to your path, not c:\Python27\python.

路径是目录列表,而不是文件。应该在路径中添加c:\Python27,而不是c:\Python27\python。

#2


3  

After installing python from the following link http://www.python.org/download/releases/, you must Update your environment variables:

在从以下链接http://www.python.org/download/releases/安装python之后,您必须更新您的环境变量:

  1. click on start
  2. 点击开始
  3. right click on computer
  4. 右键单击计算机
  5. click on advanced system settings
  6. 点击高级系统设置。
  7. click on environment
  8. 单击环境
  9. locate path on system variables
  10. 在系统变量上找到路径。
  11. click on edit
  12. 点击编辑
  13. append ;C:\Python32\ to the end of the value or wherever the installer installed your Python
  14. append;C:\Python32\到值的末尾或安装程序安装您的Python的任何地方。

Make sure you restart sublime after doing this, you will still get an error if you didn't.

这样做之后,确保你重新启动了“崇高”,如果没有,你仍然会得到一个错误。

#3


0  

The problem is related to the python command not being found in the exectuable path. You could point sublime explicitly to the python executable, or you could just fix the env path. The second is more important to have your general python set up properly.

这个问题与在exectuable路径中没有发现的python命令有关。您可以明确地指向python可执行文件,或者只需修复env路径。第二种方法更重要的是让您的通用python正确设置。

C:\Python27\;C:\Python27\Scripts\

The first location contains python.exe and the second contains a "python" script that points back to the exe. This will allow a command using "python" to work.

第一个位置包含python。exe和第二个包含指向exe的“python”脚本。这将允许使用“python”来工作的命令。

#1


3  

The path is a list of directories, not files. You should add c:\Python27 to your path, not c:\Python27\python.

路径是目录列表,而不是文件。应该在路径中添加c:\Python27,而不是c:\Python27\python。

#2


3  

After installing python from the following link http://www.python.org/download/releases/, you must Update your environment variables:

在从以下链接http://www.python.org/download/releases/安装python之后,您必须更新您的环境变量:

  1. click on start
  2. 点击开始
  3. right click on computer
  4. 右键单击计算机
  5. click on advanced system settings
  6. 点击高级系统设置。
  7. click on environment
  8. 单击环境
  9. locate path on system variables
  10. 在系统变量上找到路径。
  11. click on edit
  12. 点击编辑
  13. append ;C:\Python32\ to the end of the value or wherever the installer installed your Python
  14. append;C:\Python32\到值的末尾或安装程序安装您的Python的任何地方。

Make sure you restart sublime after doing this, you will still get an error if you didn't.

这样做之后,确保你重新启动了“崇高”,如果没有,你仍然会得到一个错误。

#3


0  

The problem is related to the python command not being found in the exectuable path. You could point sublime explicitly to the python executable, or you could just fix the env path. The second is more important to have your general python set up properly.

这个问题与在exectuable路径中没有发现的python命令有关。您可以明确地指向python可执行文件,或者只需修复env路径。第二种方法更重要的是让您的通用python正确设置。

C:\Python27\;C:\Python27\Scripts\

The first location contains python.exe and the second contains a "python" script that points back to the exe. This will allow a command using "python" to work.

第一个位置包含python。exe和第二个包含指向exe的“python”脚本。这将允许使用“python”来工作的命令。