bing
Flat 10% & upto 50% off + 10% Cashback + Free additional Courses. Hurry up
×
UPTO
50%
OFF!
Intellipaat
Intellipaat
  • Live Instructor-led Classes
  • Expert Education
  • 24*7 Support
  • Flexible Schedule

In this tutorial, we will be guiding you through the environment set up process before we dive right into the coding part. You can find the following content in this module:

Learn Python in 16 hrs from experts



Python Installation

To get started working with Python 3, first of all you will need to have access to the Python interpreter. There are numerous ways to accomplish this:

  • Either we can directly obtain it from the Python Software Foundation website at python.org.
  • Or in operating systems like Linux, there will be a package manager which can be run to install Python.
  • And on macOS, to install Python 3 first we have to install a package manager called Homebrew. We will discuss this in the relevant section in the tutorial.
  • And on mobile operating systems like Android and iOS, Python can install apps which provide an environment for Python programming.
  • Even there are so many websites that allow you to access a Python interpreter online without any installation on your system.

Now, we will see step by step installation and set-up of a working Python 3 distribution on Windows, macOS, and Linux.

Following is the list of all the topics that we are going to cover in Python Installation Guide. You can click on the topics to jump to a specific one.

  • Installation of Python on Windows
  • Install Anaconda Python and Jupyter Notebook
  • Launch Jupyter Notebook
  • Python Installation on Linux
  • Python Installation on Mac OS X

In our Python Data Science tutorial, we will be using windows system and one of the best Python IDE for windows that is Jupyter Notebook for which we will be installing Anaconda. So, let’s get started!

Python Installation

Wish to Learn Python? Click Here

Installation of Python on Windows

For Windows operating system, the installation process is as under:

  • To install Python, firstly we need to go to the download Python page from its official site python.org/download. And click on the latest version

Installation of Python on Windows

  • Once the Python distribution download is completed, then double-click on the executable downloaded software, here then click on Run

Python distribution download

Now, once the installation set up start, we need to follow the following installation steps:

Step 1: A Setup pop-up window – Python 3.7.0 (32-bit) will appear. Here we need to ensure that we have checked the checkboxes for Install launcher for all users (recommended) and the Add Python 3.7 to PATH at the bottom.

Step 1

Step 2: Now, a User Account Control pop-up window will appear, posing the question Do you want the allow the following program to make changes to this computer? Click on Yes.

step 2

Step 3: Now, a new Python 3.7.0 (32-bit) Setup pop-up window will appear with a Setup Progress message and a progress bar. During the installation, it will show you the various components it is installing, and it will move the progress bar towards completion. Soon, a new Python 3.7.0 (32-bit) Setup pop-up window will appear with a Setup was successfully message.

step 3

Step 4: Once the installation is done, click on Close button. And now Python should now be installed.

Step 4

Step 5: Now, we will try to verify installation,

  • Navigate to the directory C:\Users\AppData\Local\Programs\Python\Python37-32 (or to whatever directory Python was installed: see the pop-up window for Installing step 3).
  • Double-click the icon/file python.exe.

The following pop-up window will appear

Step 5

This pop-up window will be with the title C:\Users\AppData\Local\Programs\Python\Python37-32 appears, and inside the window; on the first line we have a text Python 3.7.0 … from here we can notice that it should also say 32 bit.

Inside the window, at the bottom left, is the prompt >>>: type exit() to this prompt and here press enter to terminate Python.

Now, we should keep the file python-3.7.0.exe somewhere on our computer in case if you need to reinstall Python.

To write a Python script file we can use any text editing software. For that, we just have to save it with the .py extension. But using a Python IDE can make developer life a lot easier. IDE is a software that provides useful features like hinting code, highlighting and checking syntax, file explorers etc. to the programmer for application development.

Some of the popular free Python IDE are PyCharm, Spyder, Rodeo and Jupyter Notebook. Jupyter NoteBook is one of the best among them.

Jupyter Notebook is a web application based on a server-client structure which allows you to create and manipulate notebook documents – or just “notebooks”.

It provides you with an easy-to-use, interactive data science environment across many programming languages that doesn’t only work as an IDE, but also as a presentation or education tool. This tool is perfect for those who are just starting out with data science!

Steps to install Anaconda Python and Jupyter Notebook

Setting up Anaconda Distribution:

Step 1 – To install Anaconda Python just go to https://www.anaconda.com/download/ and select the version then click on Download

Note book step 1

Step 2 – Execute the Exe file, install Anaconda3 popup window will appear. Here select Install for me only and then click on Continue

not book step 2

Step 3 – Next Anaconda setup window will appear here select All user and click on Next

note book 3

Step 4 – A advance installation window will appear here select Add Anaconda to my Path environment variable and click on Install

note book 4

Anaconda will get installed in our user home directory:

Windows 10: C:\Users\<your-username>\Anaconda3\

Become Python Certified in 16 hrs.
CLICK HERE

close

Steps to launch Jupyter Notebook

Once we are done with the successful installation of Python and Anaconda in our system.

  • To launch Jupyter Notebook via Command line, simply open your Anaconda Windows Command Prompt. Here type and run Jupiter notebook.

Steps to launch Jupyter Notebook

  • A Jupyter Notebook Dashboard will open on your default web browser.

Jupyter Notebook Dashboard

  • Here click on New → then click on Python 3

then click on Python 3

  • A new python kernel will get open and you are ready to write a new program.

python kernel

Running a simple program in Python

Now that we have Python and Jupyter Notebook up and running, we can continue to write our first Python program – Hello Learners! Example

Simply launch the Jupyter Notebook kernel and in the code line type print “Hello Learners!”

Running a simple program in Python

Then click on Run

Python program

Congratulations, your first Python program is executed.

Python Installation on Linux

Now, we will discuss the installation of Python on Linux Machine

Step 1 – First you have to navigate to the Python download site with your browser. Here you see different OS select the Linux/UNIX .

Step 2 – Now, you will be navigated to the Python Source Releases. Here, click the appropriate link for your version of Linux:

  • Python 3.7.2 compressed source tarball (any version of Linux)
  • Python 3.7.2 xzipped source tarball (better compression and faster download)

Step 3 – Then pop up will appear whether you want to open or save the file, choose Save. The Python source files begin downloading. Be patient: The source files require a minute or two to download.

Step 4 – Now, double-click the downloaded file. The Archive Manager window opens. After the files are extracted, you see the Python 3.3.4 folder in the Archive Manager window. Again double-click the Python 3.3.4 folder. Here, the Archive Manager extracts the files to the Python 3.3.4 subfolder of your home folder.

Step 5 – Now, open a copy of Terminal. Here, if you have never built any software on your system before, then you must install the build-essentials, like SQLite, and bzip2 otherwise you are the Python installation will fail. And if you have already installed them, you can skip to Step 9 to begin working with Python immediately.

Step 6 – Now, type sudo apt-get install build-essential and press Enter. Here, Linux installs the Build Essential support required to build packages.

Step 7 – Now, type sudo apt-get install libsqlite3-dev and press Enter. Here Linux installs the SQLite support required by Python for database manipulation.

Step 8 – Now, type sudo apt-get install libbz2-dev and press Enter. Here Linux installs the bzip2 support required by Python for archive manipulation.

Step 9 – Type CD Python 3.3.4 in the Terminal window and press Enter. Here terminal changes directories to the Python 3.3.4 folder on your system.

Step 10 – Type ./configure and press Enter. Here the script begins by checking the system build type and then performs a series of tasks based on the system you’re using. This process can require few minutes because there is a large list of items to check.

Step 11 – then type make and press Enter. Here, Linux executes the make script to create the Python application software. The make process can require up to a minute — it depends on the processing speed of your system.

Step 12 – Now, type sudo make altinstall and press Enter. Here, the system may ask you for your administrator password. Type your password and press Enter. At this point, a number of tasks take place as the system installs Python on your system.

Now, your Python is up and running. You can execute your first program!

Python Installation on Mac OS X

Now, we will discuss how to install Python 3 on your local macOS machine and we will also set up a programming environment via the command line. To do installation you will need administrative access that is connected to the internet.

To install Python on Mac OS X first you have to install Xcode then you have install Homebrew and Python

 

Python Installation on Mac OS X

Install Xcode

We require Xcode to install Homebrew and Python. You can download Xcode from the App Store.

Install Xcode

To install Xcode from the App Store is a time-consuming process after a lengthy download and install process, open a terminal and type the following command to install Xcode Command Line tools and in the next step we will install Homebrew:

Homebrew is a package manager for OSX. We can use it to install specific versions of python that coexist with and prevent pollution of, the system python.

Now go to https://brew.sh/

From here follow the directions to install Homebrew, once done paste this line into a terminal:

/usr/bin/ruby -e “$(curl -fsSL https://abc.com/Homebrew/install/master/install)”

Now that our Homebrew is installed, which is used to install python. The OSX system will still use the built-in system python, but anything you do will use the newly installed python.

Install latest python 3:
brew install python
Install latest python 3.x
brew install python3

Now, your python is up and running on Mac OS. You can execute your first program!

Become Python Certified in 16 hrs.
CLICK HERE

close

Python Program execution:

Python programs can execute in three different modes which are –

  • Interactive Mode
  • Script Mode
  • Using IDE

Interactive Mode

You can enter python in the command prompt and start working with Python.

Interactive Mode

Press Enter key and the Command Prompt will appear like:

Press Enter key and the Command Prompt will appear like

Then execute your Python Programs as follows –

Then execute your Python Programs as follows

Script Mode

You can write Python program in a separate file using any editor of OS via this mode

e.g.

Type print ‘hello world’ in notepad and save it to with .py extension suppose this file name is hello.py.

Then run this file in command prompt by typing Python hello.py

It will print hello world as output.

Using IDE

You can execute the python program in graphical user interface. Open the python as follows:

Click on Start button -> All Programs -> Python -> IDLE (Python GUI)

In IDE you can use

  • Interactive Mode
  • Script Mode

This brings us to the end of this module. We will be starting with the fundamentals of Python from the next one. See you there.

Previous Next

Download Interview Questions asked by top MNCs in 2018?

Learn SQL in 16 hrs from experts



"0 Responses on Python Installation & Program execution"

Leave a Message

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.
top

Sales Offer

Sign Up or Login to view the Free Python Installation & Program execution.