Python


Back to Extras main page


Setting up Python for Windows

I've had to do this a number of times and I always forget how whenever I need to, so I thought I'd write a little cheatsheet. I do all of this from the Windows Command line, so it should work regardless of Windows or Python version.

Walkthrough

1) Open Windows Command Line (Start > cmd.exe).

2) Create the Python path variable (just inc ase it isn't already setup).

set PYTHONPATH=%PYTHONPATH%;C:\my_python_path

Replace my_python_path with your install of python. For example:

set PYTHONPATH=%PYTHONPATH%;C:\Python27

3) Add the Python path to the "global" system path, so that you can simply type python in the command line and it'll work.

set PATH=%PATH%;%PYTHONPATH%

4) And now you're good to go! But just to make sure, it's always good to test it and make sure that the PYTHONPATH variable has been added to the PATH variable. So either type python from the command line and run it and/or do the following:

echo %PATH%

The location of your Python will be at the end of the list and you're all good to go.

---------------------------------------------------------

Back to Top