“python” not recognized as a command

后端 未结 12 1980
粉色の甜心
粉色の甜心 2020-11-22 14:01

I just downloaded and installed Python 2.7.2 to my laptop and I am trying to run some sample programs. My laptop is running Windows XP.

When I open a cmd

12条回答
  •  日久生厌
    2020-11-22 14:57

    You need to add the python executable path to your Window's PATH variable.

    1. From the desktop, right-click My Computer and click Properties.
    2. In the System Properties window, click on the Advanced tab.
    3. In the Advanced section, click the Environment Variables button.
    4. Highlight the Path variable in the Systems Variable section and click the Edit button.
    5. Add the path of your python executable(c:\Python27\). Each different directory is separated with a semicolon. (Note: do not put spaces between elements in the PATH. Your addition to the PATH should read ;c:\Python27 NOT ; C\Python27)
    6. Apply the changes. You might need to restart your system, though simply restarting cmd.exe should be sufficient.
    7. Launch cmd and try again. It should work.

提交回复
热议问题