Add Python to your Windows environment variable

If you don’t want to change the environment variables on your machine you can run your scripts from the command prompt by specifying the full path to the python.exe like this;
C:\>C:\Python24\python hello.py
If you want to change it then Start and right-click My Computer and click on Properties then click Advanced and click Environment Variables. Now scroll down along system variables until you see a variable called PATH. Click this and click edit. Now go to the end of the string and add ;C:\Python27\ or the path to your version of python. Now click OK and OK and OK again and now you’re done. The path depends on your python version installed. To find out what your path should be you could open up IDEL interpreter and type

import sys, pprint
pprint.pprint(sys.path)

Tags: