views:

141

answers:

4

I have Python 2.6 installed on Windows Vista. If I am at C:\Python26> and I type python, Python's command-line interface starts, as desired.

I have added C:\Python26 to my PATH so that I would be able to run Python scripts from any directory, but it hasn't helped. In particular, from any other directory, the command python is not recognized.

I appreciate any guesses as to what change would get this working.

Edit: First, I have re-opened my cmd window (several times) so that is not the issue.

To clarify how I added C:\Python26 to the 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 to the Variable Value field, separating this from the previous entries with a semicolon. Then I click OK a few times.

Edit #2 I've now checked my PATH by typing path at the command prompt. C:\Python26 is certainly in the path. I'll reboot anyway, and see if that helps.

+1  A: 

if you are certain that you have added the directory to the path, you may just need to open up a new command window for it to take the changes to the current path.

Deep Kapadia
No, I've already tried that.
FarmBoy
From a new cmd window, type Path <enter>, and try to find C:\Python26 in there. You will likely _not_ find it, indicating that the path variable as not effectively been changed!
mjv
There is probably a typo somewhere in your PATH then. Follow Justin's steps and you should be good.
Deep Kapadia
+3  A: 

This still sounds like a path issue.

If you have just added c:\Python26 to your path, then you need to open a new cmd window before those changes take effect, they won't apply to your existing cmd windows.

If you're unsure how to do this in Windows Vista, here is the instructions.

  1. Select Settings -> Control Panel from the start menu.
  2. Double click the 'System' icon.
  3. Choose 'Advanced System Settings' on the left hand side.
  4. Choose 'Environment Variables'
  5. In the bottom list, select 'Path', and click 'Edit...'
  6. At the end of the path string, add ;C:\Python26, leaving everything else the same, then click OK, then click OK again on the various windows still open.

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 anyone with the same problem will find the help they need in this answer.

Justin Standard
+1  A: 
  • Double and triple check that you added the path correctly and didn't make a typo.
  • Restart your machine.
Anna Lear
A: 

Other options are to reinstall or to create a .bat file with c:\python26\python.exe and put that in your path

foosion
Creating a bat file could work, but that is a hackish workaround and could cause things to be weird after upgrading. I don't recommend you take that approach - get it working right!
Justin Standard