Fatskills
Practice. Master. Repeat.
Study Guide: Python Programming: Installing Python and Setting up the Environment
Source: https://www.fatskills.com/python/chapter/python-programming-installing-python-and-setting-up-the-environment

Python Programming: Installing Python and Setting up the Environment

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~6 min read

Here, we are going to see a step by step guide to download and install the Python language interpreter. After installation of the interpreter, we will integrate and set up Python development environment with Eclipse IDE. 
Python programming language is available for all of the three known platforms for Windows, Linux/Unix, and Mac OS.

Below are the links from where Python interpreters can be downloaded for these environments.

Windows platform
Python interpreter can be downloaded for Windows platform using the link below.
https://www.python.org/downloads/windows/
Options available on Python website are as follows:
Python 3.4.4 - 2015-12-21
Download Windows x86 MSI Installer
Download Windows x86-64 MSI installer
Download Windows help file
Download Windows debug information files for 64-bit binaries
Download Windows debug information files
In this tutorial, we are going to use Windows platform to install Python 3.4.4 along with Eclipse IDE to set up a development environment.

LINUX/UNIX platform
If you are not able to find Python on your Linux or Unix OS, then Python interpreter can be downloaded for LINUX or UNIX platform from the link below.
https://www.python.org/downloads/
A different Linux version uses different package managers for installation of new packages. For example, on Ubuntu, Python can be installed using the below command from the terminal.

$sudo apt-get install python3-minimal

 


It is installed from source using the below command.

 

 

Download Gzipped source tarball from Python's download URL: https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz

Extract the tarball

tar xvfz Python-3.5.1.tgz

Configure and Install:

cd Python-3.5.1

./configure --prefix=/opt/python3.5.1

make 

sudo make install



Mac OS Platform
Python interpreter can be downloaded for Mac OS platform from the link below.
https://www.python.org/downloads/mac-osx/
Options available on Python website are as follows.
Python 3.4.4 - 2015-12-21
Download Mac OS X 64-bit/32-bit installer
Download Mac OS X 32-bit i386/PPC installer

Steps to install Python on Windows Platform
Please follow the below steps:
Check for Windows installer if it is 32-bit or 64-bit. Accordingly, download Python version for Windows platform for the given link.
Once downloaded, click on the installer. The below screen will be visible which will trigger Python installation on Windows.


Choose the first option as “Install for all users” and click on the next button to proceed.
Next, the system will ask to select the destination directory. Choose the directory as shown below and click on Next button.


Next, the system will ask to customize Python 3.4.4. Keep the default setup and click on the Next button as shown in the below screenshot.


Installer will start the installation which will take several minutes and the below screenshot will be visible during this point of time.


Once Python interpreter installation is completed, click on the Finish button to complete the installation on Windows platform.


Steps to set up Python development environment on Eclipse IDE
Please follow the below steps:
Download the Eclipse from the link below. Choose the latest stable version of the Eclipse and make sure that if your machine is 64-bit then chose 64-bit Eclipse. In this tutorial, Eclipse MARS.1 version is used.
https://eclipse.org/downloads
Click on the elipse.exe to open the Eclipse which will ask to choose a local directory as its workspace as shown in the below screenshot.
Choose or create a directory on any available drive and click on the OK button to start eclipse.


On the Eclipse, navigate as Help -> Install New Software…


It will open a dialogue box in Eclipse as shown in the below screenshot. In the textbox “work with:” enter the URL as http://pydev.org/updates and click on the Add button. Next, select the checkbox as “PyDev” and click on the Next button.


Next, the system will ask to read and accept or decline the license agreement. Accept the license agreement in order to proceed the current software installation and click on the Finish button as shown in the below screenshot.


The step above will complete the installation of PyDev software on the Eclipse. After installation, it will prompt to restart Eclipse. Upon Eclipse restart, the Python development environment is ready to use on Eclipse.
First Python project on Eclipse
Please follow below steps.
Left-hand side of Eclipse has Project Explorer. Right click in that region or navigate as New -> Project. Select PyDev from the Wizard as shown in the below screenshot.


Select PyDev Project option from Wizard and click on next button to proceed.
It will open a PyDev project dialog box asking for Project name, project type, grammar version and interpreter configuration.
Give the project name as “MyFirstPythonProject”, project type as Python, and grammar version as 3.0-3.5.
Click on the given link to configure the Python interpreter as shown below. Here we just need to give the path of python.exe where we installed Python on C drive.


Click on the Interpreter link; it will ask for how to configure the interpreter since we know the Python installation path, therefore, select “Manual Config” option. 


Click on the “New” button present at the top right corner and in the opened dialogue box, enter the interpreter name and the interpreter executable path. Since we are using Python version as 3.4.4, therefore enter the name as “Python 3.4.4” and executable path as C:\Python34\python.exe. Click OK button to complete this step.


A new dialogue box will be opened as shown. This step will ask to select all folders that are required to be added to the SYSTEM Python path. Select all and click on the OK button to complete this step.


Next, click on the Apply button and then the OK button to complete the setup for Python first project as shown in the below screenshot.


Lastly, click on the Finish button to complete first “PyDev Project” set up in Eclipse as shown in the below screenshot.


By this step, Python first project directory structure and path setup are ready as shown in the below screenshot.


               At the source directory, right click and navigate as New -> PyDev Module.


               This will open a dialogue box asking to enter package and PyDev module name. Enter the name as “FirstPython” and click on the Finish button to complete this step as shown in the below screenshot.


               The step above will open up another dialogue box, asking you to select the template for the Python project. Choose here <Empty> and click on the OK button.


               This will open the FirstPython.py file where we can edit and write the Python program code as shown in the below screenshot. Python program files have an extension as .py.


                To run the Python program above, press Ctrl+F11 keys, it will open up below dialogue box. Select “Python Run” option and click OK button to complete this step.


               The final output will be displayed at the bottom of the Eclipse in the console as shown in the below screenshot.


This completes the installation, environment setup and execution for first Python program. In the next chapter, we are going to learn about the various syntax used in Python programming.