Getting Started and Installing Python3

Upendra Pratap Kushwaha
Upendra Pratap Kushwha
4 min readApr 29, 2020

This blog post is part of our course Python Tutorial for Ultimate Beginners

In this tutorial, you will learn to install and run Python on your computer. Once we do that, we will also write our first Python program.

To get started working with Python 3, you’ll need to have access to the Python interpreter.

Installation On Windows

  1. Open a browser window and navigate to Download Page for Windows at python.org
  2. Underneath the heading at the top that says Python Releases for Windows, click on the link for the Latest Python 3 Release — Python 3.x.x. (As of this writing, the latest is Python 3.8.2.)
  3. Download either Windows x86–64 executable installer for 64-bit or Windows x86 executable installer for 32-bit.
  4. Run the Installer: Once you have chosen and downloaded an installer, simply run it by double-clicking on the downloaded file. A dialogue should appear that looks something like this:

Then just click Install Now. That should be all there is to it. A few minutes later you should have a working Python 3 installation on your system.

Installation On Mac Os

  1. Install Homebrew from https://brew.sh/
  2. Once Homebrew has finished installing, return to your terminal and run the following command
$ brew install python3

Installation On Linux(Ubuntu)

Depending on the version of the Ubuntu distribution you run, the Python install instructions vary. You can determine your local Ubuntu version by running the following command:

$ lsb_release -a

Ubuntu 17.10, Ubuntu 18.04 (and above) come with Python 3.6 by default. You should be able to invoke it with the command python3.

Ubuntu 16.10 and 17.04 do not come with Python 3.6 by default, but it is in the Universe repository. You should be able to install it with the following commands:

$ sudo apt-get update 
$ sudo apt-get install python3.6

You can then invoke it with the command python3.6.

If you are using Ubuntu 14.04 or 16.04, Python 3.6 is not in the Universe repository, and you need to get it from a Personal Package Archive (PPA). For example, to install Python from the “deadsnakes” PPA, do the following:

$ sudo add-apt-repository ppa:deadsnakes/ppa 
$ sudo apt-get update
$ sudo apt-get install python3.6

As above, invoke with the command python3.6.

How to run python code

Python is an interpreted programming language, this means that as a developer you write Python (.py) files in a text editor and then put those files into the python interpreter to be executed.

The way to run a python file is like this on the command line: Where “hello.py” is the name of your python file.

python hello.py

The output should read:

Hello, World!

What are PIP and Virtualenv

Besides this actual installation of python, these two tools PIP and Virtualenv are essential for python development.

PIP

The pip package is the most popular way to install, upgrade, and remove third-party libraries.

Virtualenv

Virtualenv is a program which you might need for the installation of python packages in a specified or particular directory. This makes sure that different versions of the python packages co-exist on the same machine.

You can install virtualenv with pip pip3 install virtualenv

Summary

  • Python is becoming more and more popular day by day and it is consistent among the top languages every year.
  • There are two versions of python: one is 2 and another is 3.
  • You can install Python in different operating systems.
  • There are two ways you can run the python code: one is python interpreter and another one is to run with .py extensions.
  • PIP and Virtualenv are the two important packages and should be used while working with python.
  • PIP is a python package manager which helps us to install, upgrade, and remove third-party libraries.
  • Virtualenv is a program that helps to maintain complete isolation from any pre-existing packages.

Conclusion

This is a very good starting point for anyone starting python for the first time. Once you know how to install, run python code, and necessary packages like PIP and virtualenv, all you need to go to the official website and practice the syntax and basics of python.

Originally published at https://blog.upendra.tech on April 29, 2020.

--

--

Upendra Pratap Kushwaha
Upendra Pratap Kushwha
0 Followers

Software Engineer — Machine Learning — Python, AWS, SQL