Pages

Monday, October 3, 2011

How to set up Python - Windows 7

Today I will be showing you how to set up python so it will run correctly on Windows 7. First you need to install python from http://www.python.org/download/. Make sure you install Python 2.7.2 and not 3.2.2. It will install to C:\Python27. Now you can run python, but only from the python folder, so we need to add a path variable.

Go to Control Panel>System>Advanced System Settings>Environment Variables. Find the path variable under System Variables and click edit. Add
;C:\Python27;C:\Python27\Tools\Scripts

to the end of the variable value. Now everything should be set up correctly.

Open notepad and create a file called test.py and inside the file type
print Testing

Now open Command Prompt. It's normally found in your start bar but you can also clock run then type cmd and it will open. In command prompt make sure you are at the folder your test.py is in. (I type cd\Users\Michael\Documents\Documents\Coding\Python to get to my folder. cd is the command to move around.) Then type
python test.py

And it should return
Testing

If it did you completed this successfully. You don't need to understand what you did just yet, this was just to make sure it was working properly, next time I will explain what you did.

If you have any questions leave them in the comments down below. See you Friday for the next tutorial.

No comments:

Post a Comment