Skip to content

Lesson 1: Installing And Running Python

May 22, 2009

You might be wondering why the big deal with installing and running python; isn’t it straight forward. Yes it is. But there are few things that might make life easier. And who doesn’t want that??

I have not tried installing on a MAC or Linux. So you might need to search up the net on how to. Windows it’s as simple as double clicking the installer.

RUNNING PYTHON

You can just open the command prompt or terminal window and type the path where you installed python. But if you find that irritating or forget the path often, here’s a handy trick.

WINDOWS

First you must do the following steps.

  1. Right click on My Computer and select Properties.
  2. Select the advanced tab and click on environment variables.
  3. In system variables, select path and click on edit.
  4. Add “C:\Python30”, after a semi-colon, to the list there (without the quotes obviously) and select ok.

You are all set to run python. Just to go to DOS prompt and type python.

NOTE:

  1. DO NOT EDIT ANY OF THE PATH VARIABLE’S VALUES. You can severely compromise the working of the system since it’s a system variable.
  2. Make sure you include no whitespaces when you type the string.
  3. If you are using a version of python different from mine or installed python in a location different from the default, then just add the correct path. The above is the default location of Python 3.0.1.

UNIX BASED SYSTEMS

For Mac OS, Linux and other Unix based systems, the Python interpreter is usually installed as /usr/local/bin/python3.0 on those machines where it is available; putting /usr/local/bin in your Unix shell’s search path makes it possible to start it by typing the command. Alternatively, just make sure THE LOCATION OF THE PYTHON EXECUTABLE FILE IS INCLUDED IN YOUR PATH VARIABLE. I think that’s all is there to it.

WHAT DID WE DO HERE??

Well, whenever you go to terminal or DOS prompt and type some filename, the OS first searches for the file in all the paths listed in the PATH variable. If there’s a positive match, then the file is opened (or here executed), else an error is returned that file not found. So, all that we do is add the path of the python application to the PATH variable and voila!!

Advertisements

From → Programming, Python

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: