Python 3 Tutorial : Setting Up Python Development Workspace


Now that we know what is python and where it is used, let’s start developing a few python programs.

In order to start developing programs in python, we need to setup our computer first.

Installing Python :

Python has 2 different stable releases and both of them are significantly different from each other.  For the purpose of this tutorial, you need to have Python 3 (3.0 or a later version) installed on your computer.

1.  First download the required Python 3 installer for your operating system from http://www.python.org/getit/ . Although Python is already installed on your Mac or Linux PC, you need to download the Python 3 installer and install it because the already installed version will be in 2.x.x.  The installer will not replace the shell version of python but instead it will create a new folder for python 3 which you can find in C:/ (on windows machines) and in /usr/local/bin (in Mac and Linux PCs)

Python3Download

2. The Installer will include a full featured command line interface for Python known as IDLE.  This application can be used to create and run python programs without any external applications.

IDLE3.  You can check whether the Python libraries are installed properly using the IDLE application or going to the director where Python is installed and executing the command ‘python’ in a Command Prompt (Windows only).

Installing Python Plugin for Eclipse:

If you’re like me you must be loving the IDE called Eclipse.  It’s a full featured IDE for various programming languages and best of all, its free. If you haven’t tried Eclipse yet, you can download the basic Eclipse Classic at http://www.eclipse.org/downloads/.

NOTE : You do not have to install Eclipse for trying out Python Programs.  This application is only for who would find an IDE more easier to organize the files. The IDLE application and a simple Text Editor is enough to create and execute all python programs.

In order to get Python Programs working in Eclipse, you need to have PyDev Python Plugin installed in your IDE.  Let’s see how to do that :

1.  Open up Eclipse.

2. Goto Help > Install New Software.

Install New Software

3. In the Install New Software Dialog Box, Click Add.

Add

4. In the Add Dialog Box, set the Name to ‘PyDev’ and the Location to ‘http://www.pydev.org/updates’ (without quotes).

AddPydev

5. Click OK. After a few minutes, you will be seeing two items on the Install New Software Dialog Box. Check ‘PyDev’ and click Next.

PyDevNext

6. Click Next and Follow the Instructions to Install the PyDev Plugin.

7. Now we need to setup the Python3 for the PyDev Plugin and to do that, goto Preferences in Eclipse (Window -> Preferences in Windows and Eclipse -> Preferences in a Mac). Goto Interpreter – Python and Click New.

Intrepreter

8. Select the Python3 executable from /usr/local/bin/python3.2 (For Mac) and in C:/python32/python3.exe (For Windows)

NewImage

WindowsPython

9. Once you are done, you will be asked the required libraries. Just Click OK.

SelectionNeeded

10. All the libraries are added. Click OK and You are done.

NewImage

11. (Optional) You can got General -> Editors -> Text Editors and Check the ‘Show Line Numbers’ if you wish to see Line Numbers in your program.

12. Turn on PyDev Environment by going to the Right Top Corner and clicking on the Squared icon with a Plus sign -> Other -> PyDev.

NewImage

PyDevSet

 

Time To Test Our Environment :

Now that we have set up the environment for Python Development. Let’s test it whether everything turns out okay.

For IDLE Users :

1. Open Up IDLE.

2. Write a simple print statement :

print (“Hello From Parithi”)

IDLETest.png

If you could see the output shown on the screenshot, then Congrats! You have written and executed your first Python Program.

If you wish to create python files and execute them,

1. Goto File -> New Window.

NewImage

2. Save the File with a extension of .py. Example myfile.py.

3. Run the Module by Run -> Run or Press F5. The Output will be displayed in the IDLE Screen.

NewImage

 

For Eclipse Users :

1. Create a New Project by File -> Project -> PyDev Project.

NewPyDev

2. Click Next and Set the Name for the Project. Set the Grammar Version to 3.0.

NewProject

3. Click Finish and Right Click on the Project Folder. Click New -> PyDev Module.

PyDevModule

NewFile

4. Type the Program in the Code Editor for test.py :

print (“Hello From Parithi”)

Program

5. Save the File and Click the Green Play Icon on the Top or goto Run -> Run. In the ‘Run as’ Dialog Box -> Select ‘Python Run’ and Click Ok.

Run

6. If everything goes well, you will see the output on the console window :

NewImage

Congratulations, You have successfully installed and executed your first Python Programs.  Now let’s start with the Basics of Python Development

ElamParithi Arul is Editor At Large and the Owner of Tech Twinklers. He is the founder of the Parithi Network. Basically being a 23 year old Whizkid, He's A Mac User. An Adventurer. A Tech Enthusiast, An Avid PC and PlayStation Gamer, A Hobbyist Photographer and a Nature Lover. His basic interests are developing Websites, Apps and coming up with various creative ideas for a better vibrant tomorrow. He is a professional blogger for about 4 years and writes blogs regarding technology, gaming, and about his own personal life. You can follow him on Twitter at @Parithi

You may also like

LEAVE A COMMENT

Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!