Beginning Python Prgramming! How to Download, install, compile & run program in Python

I’m going to start a new thread – Beginning Python Programming! I’ll post step-by-step easy tutorials on Python in this blog.

Please note that I’m also a beginner, and the facts which I’m learning, will be posted here. So don’t hesitate to make corrections whenever I make mistakes.🙂

Step 1: Download Python

Download Python 3.1 or another stable version for Linux/windows/Mac/ from this link. For Ubuntu, you can download python and IDLE (the Python GUI) from Add/Remove Programs!

IDLE is enough for serving the purpose of IDE! It will be automatically installed with the package you downloaded from python website.

Step2: Code in Python, copile & run it!

Using the IDLE

IDLE is the best IDE for a quick coding practise. In the IDLE, you can type a single line of code and see the output immediately. No need to create a source file or copile it! This is a great tool for quick demonstration of a bit of code.

You can type as many Python commands as you like; each is run immediately after it’s entered. Moreover, because the IDLE automatically prints the results of expressions you type, you don’t  need to say “print” explicitly at this prompt. No need of typing a semicolon after each line of code.

In Windows, Open the Python IDLE (you can find it in the Start menu )

In Ubuntu/Linux, you can find the IDLE in your main menu > Programming

Alternately, if you don’t have the IDLE installed, you can obtain the same effect from your Command-Prompt:

In windows, open a Command Prompt from Start Menu, Then type:


Note, here I’m using Python 2.6, so the  I typed python26 in the command above. If you have a different version, your command will change! Go to your C directory, and look for a folder named Python**, herer ** reflects the version.

In Linux or Unix, open a terminal (shell) and type:

/usr/local/bin/python (or /usr/bin/python)

Writing Source Code in files and running it:

Although you can type codes in the IDLE, they get lost as soon as the IDLE quits. So, you can store your source codes at source files and then run your codes from command prompt. We generally use a .py extension for Python source-files.

For a quick demonstration, create a new file called and open it for editing by your favourite editor (I’ll prefer the IDLE editor)

Type following lines of codes in the file just opened:

echo "Hello, World"           # This is a comment! Anything after the # is ignored
echo 2 ** 4                   # This will output 2^4

Save the file. Open your command-prompt to run. Just type the full path of the source file after the python command

Windows users:

c:\python26\python c:\codes\

Assuming that the source file is available at C:\codes directory!

9 thoughts on “Beginning Python Prgramming! How to Download, install, compile & run program in Python

  1. One important Note: When you are running source-files from command prompt, they immediately quits after showing output. So, you cannot actually view the output as they just show and quit immediately.

    To prevent this, you can type an extra command at the end or your source-file:

    raw_input("Press enter to continue...")

    Once you add this command, the code window will wait for a dummy input. I.e. the window will wait until you press the Enter button of your keyboard.

  2. This is a nice intro to installing and running simple Python programmes. Have you thought of making it into a youtube video?

    If you do, you will quickly have a huge following because your style of presenting is very easy and detailed.

    1. Thanks a lot for your valuable suggestion! I didn’t think about making a video tutorial, actually I’m not quite expert in it. But I’ll try my best to follow your suggestion.

      Keep visiting and advising me😀

Leave a Reply

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

You are commenting using your 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