Adding Python Path on Windows 7

I've been trying to add the Python path to the command line on Windows 7, yet no matter the method I try, nothing seems to work. I've used the set command, I've tried adding it through the Edit Environment variables prompt etc.

Further more if I run the set command on the command line it lists this

python = c:python27

Yet it still doesn't recognize the Python command.

Reading the documentation, and various other sources hasn't seemed to help.

Edit: Just to clarify further, I've appended the path of the Python executable to PATH in edit environment prompt. Doesn't seem to work.


  • Hold Win and press Pause.
  • Click Advanced System Settings.
  • Click Environment Variables.
  • Append ;C:python27 to the Path variable.
  • Restart Command Prompt.

  • When setting Environmental Variables in Windows, I have gone wrong on many, many occasions. I thought I should share a few of my past mistakes here hoping that it might help someone. (These apply to all Environmental Variables, not just when setting Python Path)

    Watch out for these possible mistakes:

  • Kill and reopen your shell window: Once you make a change to the ENVIRONMENTAL Variables, you have to restart the window you are testing it on.
  • NO SPACES when setting the Variables. Make sure that you are adding the ;C:Python27 WITHOUT any spaces. (It is common to try C:SomeOther; C:Python27 That space (␣) after the semicolon is not okay.)
  • USE A BACKWARD SLASH when spelling out your full path. You will see forward slashes when you try echo $PATH but only backward slashes have worked for me.
  • DO NOT ADD a final backslash . Only C:Python27 NOT C:Python27
  • Hope this helps someone.


    Open cmd .exe with administrator privileges (right click on app). Then type:

    setx path "%path%;C:Python27;"

    Remember to end with a semi-colon and don't include a trailing slash.

    链接地址: http://www.djcxy.com/p/26364.html

    上一篇: 我如何在Windows上安装Python软件包?

    下一篇: 在Windows 7上添加Python路径