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.
source to share
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.
source to share