I'm trying to figure out how to run Python programs with the Command Prompt on Windows 7. (I should have figured this out by now...)
(我试图弄清楚如何在Windows 7上使用命令提示符运行Python程序。(我现在应该已经想到了...))
When I typed "python" into the command prompt, I got the following error:
(当我在命令提示符下键入“python”时,出现以下错误:)
'python' is not recognized as an internal or external command, operable program or batch file.
('python'不被识别为内部或外部命令,可操作程序或批处理文件。)
The first place I found when looking for help was this site: http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows .
(我在寻找帮助时找到的第一个地方是这个网站: http : //docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows 。)
It was somewhat helpful, but the tutorial was written for Windows 2000 and older, so it was minimally helpful for my Windows 7 machine.
(它有点帮助,但该教程是为Windows 2000及更早版本编写的,因此它对我的Windows 7机器的帮助微乎其微。)
I attempted the following: (我尝试了以下方法:)
For older versions of Windows the easiest way to do this is to edit the C:\AUTOEXEC.BAT >file.
(对于旧版本的Windows,最简单的方法是编辑C:\ AUTOEXEC.BAT>文件。)
You would want to add a line like the following to AUTOEXEC.BAT: (您可能希望在AUTOEXEC.BAT中添加如下所示的行:)
This file did not exist on my machine (unless I'm mistaken).
(这个文件在我的机器上不存在(除非我弄错了)。)
Next, I tried this: (here: How do I run a Python program? )
(接下来,我尝试了这个:(这里: 我如何运行Python程序? ))
Putting Python In Your Path
(把Python放在你的路上)
Windows
(视窗)
In order to run programs, your operating system looks in various places, and tries to match the name of the program / command you typed with some programs along the way.
(为了运行程序,您的操作系统会在不同的位置查找,并尝试在此过程中将您键入的程序/命令的名称与某些程序相匹配。)
In windows:
(在Windows中:)
control panel > system > advanced > |Environmental Variables|
(控制面板>系统>高级> |环境变量|)
> system variables -> Path (>系统变量 - >路径)
this needs to include: C:\Python26;
(这需要包括:C:\ Python26;)
(or equivalent). ((或同等学历)。)
If you put it at the front, it will be the first place looked. (如果你把它放在前面,那将是第一个看的地方。)
You can also add it at the end, which is possibly saner. (您也可以在最后添加它,这可能更安全。)
Then restart your prompt, and try typing 'python'.
(然后重新启动提示,并尝试键入“python”。)
If it all worked, you should get a ">>>" prompt. (如果一切正常,你应该得到一个“>>>”提示符。)
This was relevant enough for Windows 7, and I made my way to the System Variables.
(这对于Windows 7来说已经足够了,我开始使用系统变量。)
I added a variable "python" with the value "C:\Python27" (我添加了一个变量“python”,其值为“C:\ Python27”)
I continued to get the error, even after restarting my computer.
(即使重新启动计算机,我仍然会收到错误消息。)
Anyone know how to fix this?
(有人知道怎么修这个东西吗?)
ask by Adam Seitz translate from so