Why can't I call python from the command line?

I have Python 2.6 installed on Windows Vista. If I am in C:\Python26>

and I type python

, the Python command line interface is launched as desired.

I added C:\Python26

to mine PATH

so that I can run Python scripts from any directory, but that didn't help. In particular, the command is python

not recognized from any other directory .

I appreciate any guess as to which change will make this work.

Edit: First, I reopened my cmd window (multiple times) so this is not a problem.

To clarify how I added C:\Python26

in PATH

, I clicked the following:

Computer -> System Properties -> Advanced System Settings -> Environment Variables

at the point i select PATH

and click "Edit". I added C:\Python26

a Variable Value to the field, separating this from previous entries with a semicolon. Then I click OK several times.

Edit # 2 I have now checked mine PATH

by typing PATH

in the command line. C:\Python26

is definitely on the way. I'll reboot anyway and see if that helps.

+2


source to share


5 answers


This still sounds like a path problem.

If you just added c: \ Python26 to your path, you need to open a new cmd window before these changes take effect, they will not apply to your existing cmd windows.

If you don't know how to do this in Windows Vista, here are the instructions.



  • Select "Settings" → "Control Panel" from the "Start" menu.
  • Double click the System icon.
  • Select "Advanced System Settings" on the left side.
  • Select "Environment Variables"
  • In the lower list, select "Path" and click "Change ..."
  • At the end of the path line add ; C: \ Python26 , leaving everything else the same, then click OK and then click OK again in different open windows.

Now open a new cmd window and try the "python" command from any directory - it should work.

This may be obvious to most people, but hopefully someone with the same problem will find the help they need this answer.

+6


source


if you are sure you have added the directory to the path, you just need to open a new command window for it to make changes to the current path.



+1


source


  • Double and triple check if the path was correctly added and not a typo.
  • Restart your computer.
+1


source


In the top bar where it says User Variables for YOUR NAME HERE, select the path, click the top edit button.

Add ";C:\Python26"

no quotes at the end of the text in the text box "Variable Value"

.

This solved the problem for me.

+1


source


Other options are to reinstall or create the .bat file from c: \ python26 \ python.exe and put it in your path

0


source







All Articles