Table of Contents
Welcome to the Python tutorial
It doesn’t matter whether you are a beginner or you are here only to revise your concepts, because, here I am going to teach you right from the basics. Let’s get started. Here in this article, we will guide you on how to install Python. You can install python on Windows or on Mac OS or on Linux.
Python is an interpreted, object-oriented programming language. Python is a cross-platform programming language. It runs on multiple platforms like Windows, macOS, Linux, and has even been ported to the Java and .NET virtual machines. It is free and open-source. If you are new to the programming languages, then Python is the easiest language to start with.
Python Properties
Python is…
- Strongly typed. It enforces data types so you can’t concatenate a string and an integer, for example.
- Dynamically, implicitly typed. So, you don’t have to explicitly declare variable data types. Data types are enforced at runtime.
- Case sensitive. For example,
token
andTOKEN
are two different variables. - Object-oriented. Including functions, everything in Python is an object.
Applications of Python
Python is used to develop web applications, graphic user interface based applications, software development applications, scientific and numeric applications, network programming, games and 3D applications, and other business applications. Python makes an interactive interface and easy development of applications. Some of the real-life examples are Youtube, Instagram, Spotify, Pininterest, DropBox, etc.
Installing Python
Install Python on Windows
You can download python from https://www.python.org/downloads/windows/
Click on the “Latest Python 3 Release – Python x.x.x” link. If your computer is running a 64-bit version of Windows, download the Windows x86-64 executable installer. Otherwise, download the Windows x86 executable installer. After downloading the installer, follow the steps for installation. During the installation make sure to select “Add Python 3.x to PATH”
Install Python on Mac OS
Mac OS X comes with Python 2.7 out of the box.
You do not need to install or configure anything else to use Python 2. These instructions document the installation of Python 3.
Install Xcode
Before installing Python, you’ll need to install GCC. GCC can be obtained by downloading Xcode. Xcode is Apple’s Integrated Development Environment (IDE). You might already have Xcode on your Mac. If not, you can get Xcode from the Apple AppStore.
Install Brew
To install Homebrew, open Terminal
or your favorite OS X terminal emulator and run
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The script will explain what changes it will make and prompt you before the installation begins. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH
environment variable. You can do this by adding the following line at the bottom of your ~/.profile
file
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
If you have OS X 10.12 (Sierra) or older use this line instead
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
Now, we can install Python 3:
$ brew install python
If the Homebrew version of Python 2 is installed then pip2
will point to Python 2. If the Homebrew version of Python 3 is installed then pip
will point to Python 3.
# Do I have a Python 3 installed?
$ python --version
Python 3.7.1 # Success!
Install Python on Linux Ubuntu
It is very likely that you already have Python installed out of the box. To check if you have it installed (and which version it is), open a console and type the following command to install python on Linux Ubuntu :
$ python3 --version Python 3.6.1
If you have a different version of Python installed, at least 3.4.0 (e.g. 3.6.0), then you don’t have to upgrade. If you don’t have Python installed, or if you want a different version, type this command into your console:
$ sudo apt install python3
This article is a part of the Python Tutorial.