1

I have Python installed on D:\python27. Now I want to kno how to make it so that I don't have to type

D:\python27\python.exe myscript.py

but instead, just use

python myscript.py

I know that this should already be configured after the install but somehow, the laptop I'm using didn't register the python shortcut. So how do I set it manually?

4

2 回答 2

5

win7的开始菜单:

  1. 右键单击“计算机”。

  2. 选择“属性”

  3. 点击“高级系统设置”

  4. 点击“环境变量”

  5. 在“系统变量”子部分下选择变量Path并单击“编辑”。

  6. 将“;C:\Python27”追加到现有路径,点击ok,ok。

  7. 重新启动您打开的任何控制台以使新路径设置生效,并尝试键入“python”以启动 python 会话,它应该会为您启动。

于 2012-07-02T03:58:44.307 回答
4

在命令行上:

set PATH=%PATH%;d:\python27

要在重启后保持不变,请通过 system->properties 更新您的环境变量。

于 2012-07-02T03:55:29.240 回答