如何在 sublime text 3 上运行 python 代码?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21578149/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:11:10  来源:igfitidea点击:

How to run a python code on sublime text 3?

pythonsublimetext3

提问by user3275284

i tried to run my code on windows 8 using ctrl+B but it gave the following error.

我尝试使用 ctrl+B 在 Windows 8 上运行我的代码,但出现以下错误。

'python' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "C:\Users\vishal_pc\Documents\python_codes\helloworld.py"]
[dir: C:\Users\vishal_pc\Documents\python_codes]
[path: c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;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)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft\Web Platform Installer\]

some body please help! thank you.

一些身体请帮忙!谢谢你。

回答by Will

It looks like your PATH isn't setup correctly. Sometimes this happens when you install Python in a specific folder instead of the default C:\Python folder (e.g. C:\Python27)

看起来您的 PATH 设置不正确。当您将 Python 安装在特定文件夹而不是默认的 C:\Python 文件夹(例如 C:\Python27)时,有时会发生这种情况

To setup your PATH, right click on 'My Computer' and click 'Properties', then in the 'System Properties' click on the 'Advanced' tab. In the 'System variables' section, you'll see a variable called 'Path'. Now add where you installed Python to that list (additional items are appended with a semicolon).

要设置 PATH,请右键单击“我的电脑”并单击“属性”,然后在“系统属性”中单击“高级”选项卡。在“系统变量”部分,您将看到一个名为“路径”的变量。现在将您安装 Python 的位置添加到该列表中(其他项目用分号附加)。

For example, if you installed on C:\Program Files\Python27 then you would add ";C:\Program Files\Python27" to your PATH variable.

例如,如果您安装在 C:\Program Files\Python27 上,那么您需要将“;C:\Program Files\Python27”添加到您的 PATH 变量中。

回答by Fitsum Alemu

Steps to fix it easily [For Pyhton 3.X] 1. Uninstall current version 1. Reinstall Note : Make Sure You Allow the Check box as Shown in the figure [Based on 3.7]

轻松修复的步骤 [For Pyhton 3.X] 1. 卸载当前版本 1. 重新安装 注意:确保您允许如图所示的复选框 [基于 3.7]

... enter image description here

... 在此处输入图片说明