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\
I know this post is old but I'd like to add that the solutions assume admin privs. If you don't have those you can:
Go to control panel, type path (this is Windows 7 now so that's in the Search box) and click "Edit Environment variables for your account". You'll now see the Environment Variable dialog with "User variables" on the top and "System variables" below.
You can, as a user, click the top "New" button and add:
Variable name: PATH
Variable value: C:\Python27
(no spaces anywhere) and click OK. Once your command prompt is restarted, any PATH in the User variables is appended to the end of the System Path. It doesn't replace the PATH in any other way.
If you want a specific full path set up, you're better off creating a batch file like this little one:
@echo off
PATH C:\User\Me\Programs\mingw\bin;C:\User\Me\Programs;C:\Windows\system32
title Compiler Environment - %Username%@%Computername%
cmd
Call it "compiler.bat" or whatever and double click to start it. Or link to it. Or pin it etc...
Working with Windows environment variables is always a horrible experience. Recently, I found an amazing tool called Rapid Environment Editor, which gives an awesomely simple GUI for managing them.
If you use chocolatey, you can install it using choco install rapidee
. Otherwise, take a look at http://www.rapidee.com/en/download
Re-reading this, it sounds like a paid shill, but I swear I'm not! It's just been one of the most useful utilities in my toolkit for a while and I'm surprised no one seems to know about it.
Python comes with a small utility that does just this. From the command line run:
c:\python27\tools\scripts\win_add2path.py
Make sure you close the command window (with exit
or the close button) and open it again.
If Python was installed with another program, such as ArcGIS 10.1 in my case, then you also must include any extra folders that path to the python.exe in your Environment Variables.
So my Environment Variables looks like this:
System variables > Path > add ;C:\Python27\ArcGIS10.1
Make sure you don't add a space before the new directory.
Good: old;old;old;new
Bad: old;old;old; new
;C:\python27
to the Path
variable.