Monday, January 20, 2014

Python - Setting up Python on your computer






I'm going to begin with an introduction to Python because it is much more accessible to those with no programming experience. It will allow you to learn how programming works without having to worry about the complexities of memory management and compiling. All of the set up instructions will be based on a Windows operating system because that is what I use. If you have a Linux operating system, you probably already have a pretty good idea of how to set up a programming environment. Python comes pre-installed on Mac OS X or later, but the version is usually outdated. It is recommended that Mac users download on of the current installers from the link below.

In order to begin programming, you'll need to download the programming language. You can find the download for Python here. I currently use Python 2.7.6 but there are other versions. The two "current" versions are 2.7.6 and 3.3.3. Simply download and install your version of choice.

Once installed, you'll want to make sure that the proper environment variables have been created and create them if necessary. To check your environment variables, go to your control panel and search for "system".


Next, if the "Edit the system environment variables" is an option, choose it. Otherwise click on "System", choose "Advanced system settings" and in the "Advanced" tab select "Environment Variables".


For now there are two variables to be aware of: Path and PYTHONPATH. First, under system variables select your "Path" variable and select edit.

Check that the "variable value" field of your path variable contains the folder where you installed python. It will probably be something like "C:\Python27" or "C:\Python33". If the folder is not there, add it at the beginning. Be sure to put a semicolon at the end of the folder name to separate it from the other entries. When you are finished adding the entry, press "OK".

 Note - Your install directory might be different from the above example, be sure to use the path from your system.

Next, check for a system variable called PYTHONPATH. If it is not present create it by pressing the "New..." button under system variables. Be sure to type PYTHONPATH in caps.

Make sure that the same install folder as above is in the "Variable value" field for the PYTHONPATH variable as well.

That should be enough for the setup. You are now ready to begin using Python to write code. Some systems might require a restart at this point. 


No comments:

Post a Comment