2012-09-10 70 views
-1

我已经在本地机器(Windows 7)中安装了pyton 2.7.3,并按照http://docs.python.org/tutorial/interpreter.html的说明操作,我尝试使用cmd提示设置路径。如何设置Python的路径

集路径=%路径%; C:\ python27

但是,当我在命令行键入此错误显示

Traceback (most recent call last): File"<stdin>",line 1, in <module> 
Nameerror:name 'python' is not defined 

我还试图添加路径手动

Start Menu > Control Panel > System & Security > System > Advanced System Settings/ 

Under System variables-path->edit and added this code ;C:\python27 

但仍然当我t ype python in command line我得到同样的错误

我该怎么办?

+8

这听起来像你键入“蟒蛇”的Python里,而不是在系统命令行。描述你如何进入你输入的命令行。 – BrenBarn

+0

@BrenBarn我是新来的蟒蛇;我在python命令行中输入了代码 – Eka

+1

如果您已经在Python命令行中,那么设置路径已经太迟了:您已经在运行Python。正如您链接到的文档所述,您需要在DOS框中键入“设置路径”*(例如,通过从开始菜单中选择“命令提示符”) – BrenBarn

回答

2

您必须执行第二部分,在Python解释器本身中执行python命令。