Lesson 1: Installing And Running Python
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.
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.
First you must do the following steps.
- Right click on My Computer and select Properties.
- Select the advanced tab and click on environment variables.
- In system variables, select path and click on edit.
- 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.
- 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.
- Make sure you include no whitespaces when you type the string.
- 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!!