python installtion

Set up Python in windows computer:

Hello there and welcome to this new article! In this article, I’ll show you how to set up Python in your computer.

Specifically these instructions are for Windows users so if you are a Mac or Linux user you can skip this and you can go to the next lecture where I’ll show you how to set up Python on a Mac and instructions also work for Linux users so Windows users please follow if you haven’t installed Python yet, we’re going to download and install python and also try Python out. And so you go to that’s the official Python website and you go to downloads and here you’ll see the latest Python version. Currently, it is 3.6.0. Just click that and save file.

Once you have downloaded the dot exe file just click it. Run. You can choose to install it in the default directory but you can also do a customized installation if you want to change the directory, anyway make sure you have checked this option at Python 3.6 to PATH so I’m going to go with theDefault installation process.

That was it so simple. Set up was successful.

You can close the window now and we can go ahead and open Python so how do we do thaton windows? Well we can press the Windows key button, so we’re talking about the Win key. By pressing it you will be able to search on the start button, alternatively you can simply go to the start button, click it and then type cmd and then click on c armed.exe and that will open the windows command prompt.

To open Python all you have to do is type in Python and that will open an interactive session of Python and an interactive session is best for testing out so here you can write lines of code one by one like that you promptly get the results in here.

So this is why we call it interactive, but you cannot, it’s not very appropriate to write multiple lines of code, so let’s say you have a program that has 10 lines of code and in that case you’d want towrite those lines in a file, in a Python file but we will cover that later and this is the interactive shell this is good for testing, so before you do a program you are not sure about certain aspects, certain commands that you want to include, certain keywords that you want including in your program so you test things out in here very quickly.

This is very efficient and it’s also good for learning. To exit the interactive shell you press exit andbrackets, open and closing brackets.

Now something you maybe, you probably noted was that the Python that I opened was version 3.5.2 but why is that because I installed Python 3.6 in here, 3.6, so why did I get five Python 3.5.2? Well the answer is that I already had Python 3.5.2 installed on my Windows so in other words before I install Python 3.6 I could trigger a Python shell like that so the question is how do I run Python 3.6 now? Well the first thing you should know is that there is no problem having multiple Python installations in your system, the key here is that you have to assign different commands to each of your Python installations so for instance Python 3.5.2 has these commands to run Python.

Now for Python 3.6 we need to assign another command and I’ll go and search for the installation directory of Python 3.6 so open that and now Windows when you search for Python, when youenter the Python command here, Windows is looking at the path variable, the Windows path variable and it’s searching for this type of command Python but this was already occupied by another so by Python 3.5.2, that’s why it triggers Python 3.5.2, so in that case you may want to dotrick here, let’s say do Python 36 and restart that command prompt and then run again python 36 and you get Python 36.

If you install Python for the first time, if you install Python 3.6 you’ll be able to execute Python with this commands.

If you had an existing Python installation and you install a new one, no problem, you can run Python 36 like I did I hope this was clear and I hope you are up and running now with Python.

Set up Python in a Mac computer:

Hi and welcome to this new article, in this you’re going to learn how to set up Python in a Mac computer so if you are Windows user you can skip this because you have a Windows computer and we explained how to set up platform on Windows previously in the previous article and the instructions will also work for Linux computers because a Mac is based on Unix.

let’s begin, first thing you need to know is that you already have Python on your Mac so Python comes shipped with Mac by default now let’s go and open Python.

Please refer below screen shot and click highlighted box and type terminal and then open a terminal app.

So terminal is equivalent of a command line on Windows and here let’s go ahead and open Python, you can simply call Python and if you see these three arrows there that means you are able to start a Python session so good news

However if you look here you’ll see this is Python 2.7 so it’s a bit outdated and the current version of python is Python 3 so it’s recommended that you actually install Python 3 on your Mac or Linux instead of using the old version Python 2.7 because we’re going to use a lot of libraries later on the course and some libraries may not be compatible for Python 2.7. You can still work with to python 2.7 if you take the responsibility to fix errors and compatibility issues that may arise as you learn Python, so it’s going to be maybe some extra work, however I advise you to install Python 3, so I’m going to exit Python 2 and the Python 2 session, exit and two brackets and you go again backto the terminal.

To install Python 3 open a browser and then you should go to, then go to downloads and then install the latest version of Python which should be shown here.

So python 3.6 is the current version and that should download Python, and please don’t uninstall Python 2.7 if you are planning to install Python 3.6 because Python 2.7 is connected to your operating system so if you uninstall it you may harm your operating system so you may get some messy errors there so simply ignore python 2.7 and so leave it be, don’t uninstall it and simply click on this package that you had just downloaded you should see the installation wizard

So simply go and click continue, continue, continue again and read the license if you like. I’m going to go and click on agree and than install provide your user name in there, your Mac user name, click on install software and so finally the installation was smooth and it was successful.

Click close and go back to terminal so again if you enter Python you’re going to get Python 2.7.

So how do you get Python 3? Well exit and simply click Python 3 just like that execute and you’ll see that this is Python 3.6.

Normally this is the command you will be using on Mac which means whenever I type Python on Windows you’re going to type Python 3 on Mac or Linux as easy as that, so now you have Python installed and here you can do operations, you know you get the idea.

However please note that what we do here we programming interactively so we’re simply writing some lines with code but these lines will not be saved anywhere if we write them in this interactiveSession, so what we want to do is we want to write scripts of code, so Python files which we can save, we can save the code and we can execute all the lines at one and we’ll be doing that in the next section so please follow me and I hope it works for you.

Installation on Ubuntu:

First, let’s see what version of Python is installed on the Ubuntu system and type it on the terminal Python as shown below –


sravyaweb@ubuntu:~$ python -version

The program ‘python’ can be found in the following packages:

* python-minimal

* python3

Try: sudo apt install <selected package>



If you are using Ubuntu 14.04 or 16.04 , you can use  Jonathon F in Launchpad. to install Python 3.6:

sudo add-apt-repository ppa:jonathonf/python-3.6

sudo apt-get update

sudo apt-get install python3.6

The second case:
If you are using Ubuntu 16.10 or 17.04 , Python 3.6 is located in the universe repository, upgrade directly apt-get, and then install –

sudo apt-get update

sudo apt-get install python3.6

Now check out the current version of Ubuntu:

sravyaweb@ubuntu:~$ sudo lsb_release -a

[sudo] password for sravyaweb:

No LSB modules are available.

Distributor ID: Ubuntu

Description: Ubuntu 16.04.1 LTS

Release: 16.04

Codename: xenial


Hint: Ubuntu can’t find add-apt-repository a solution to the problem, execute the install command: apt-get install python-software-properties,  in addition to this, install it apt-get install software-properties-common, and then you can use add-apt-repository it.

According to the system information shown above, the system version is: Ubuntu 16.04.1 LTS , so the first case is to install Python 3.6 , so the complete installation steps are as follows :

sudo apt-get install python-software-properties

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:jonathonf/python-3.6

sudo apt-get update

sudo apt-get install python3.6

Note that there may be interruptions or errors in the above command execution, and you can try to execute it several times.

When the above command is successfully executed, by default, it will be a Python 2.7 installed, enter at the command line prompt: pythonthen it uses Python 2.7 , if you want to use Python 3.6 , you can directly enter: python3.6, Verify the installation results are as follows:

Compile and install Python 3.6 from source.
Or, if you have the time and effort, you can also try to compile Python 3.6 from source .

Source code download address:

First, you need to install some build dependencies using the following command.

sudo apt install build-essential checkinstall

sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then, download the Python 3.6 source code from


Next, unzip the tarball.

tar xvf Python-3.6.0.tar.xz

Now cd go to the source directory, configure the build environment and install it.

cd Python-3.6.0/


sudo make altinstall

Make the altinstall command skip to create a symbolic link, so it /usr/bin/pythonstill points to the old version of Python, ensuring that the Ubuntusystem will not break.

Once this is done, you can use Python 3.6 by typing the following command:

$ python3.6





1 -d Provide debug output
2 -O Generate optimized bytecode (results are .pyofiles)
3 -S Do not run the import site to find the Python path when starting
4 -v Detailed output ( importdetailed tracking of statements)
5 -X Disable class-based built-in exceptions (only strings); 1.6obsolete since versioning
6 -c cmd Run a Python script as a cmdstring to send
7 file Python script file from a given run

Command line script

You can execute Python scripts on the command line by calling the interpreter in your application, as shown in the following example.

$python # Unix/Linux





Leave a Reply

Your email address will not be published. Required fields are marked *