Our last post was more about why you should be using Python, with this post covering the finer details of how to install Python onto your system.
Not everything about learning Python is glamorous and this is probably one of the least glamorous things you'll do is install Python. The following post is basically about installing Python onto your system. It's pretty simple and we'll go through the installation for Windows, Mac and Linux systems.
You'll probably need about 25Mb of disk space to install Python onto your system, but this is usually not a problem these days, so the footprint Python leaves on your system will not really be noticeable.
This makes execution of Python code a little slower than compiled languages as the interpreter basically performing both error checking, converting the language into machine code and the running the program all in the same go.
When you install Python onto your system, you will also get the Idle interactive interpreter which allows you to type a command and allow to see the result of the code straight away. It's a good way to learn and test your code before implementing it into a program. Installations of Python may also come with Pip which is a package manager for Python and allows you to install extra libraries and modules onto your system. You should see this installed on your system automatically when installed onto Windows, but may need to install this onto your system if you are using Linux or Mac. You may not need this until later on after you have started programming.
1. Install from the Windows Store
One of the easiest places to start with a Windows installation of Python is by using the Windows Store where you'll find a large number of Python versions available, and don't worry there pretty much all free. Simply click on the version you need, download and then install on your device.
The installation from the Windows Store will Python, Pip, Idle and the documentation.
2. The Windows Python Installer
Python also provides a simple to use installer from the following download link:
https://www.python.org/downloads/
Once again choose the version you want to install and follow the prompts from the installer. Make sure you select the "Add python to path checkbox" so you'll be able to run Python from the command line.
The verify you have Python installed on your system, open Powershell and type py in the command prompt and this should start the Python interactive interpreter on your system. You should see an output similar to the one below:
py
Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information. >>> quit()
You can also run Idle pretty simply by clicking the Windows key and then typing Idle in the search box.
Before you start installing, it's probably best to check if Python is already installed on your Mac.
# Check the system Python version
$ python --version
# Check the Python 2 version
$ python2 --version
# Check the Python 3 version
$ python3 --version
If you don't have Python installed already and need to install it, the easiest way to go on Mac is using Brew. Open a terminal on your Mac and run the following command:
$ brew install python
Python also provides an installer similar to the one provided for Windows. You can use the same link provided above.
Access a terminal screen
# debian/ubuntu
$ sudo apt-get update
$ sudo apt-get install python3
# Red Hat/CentOS
sudo yum install python3 -y
Thats about all there is to it...I admit not the most glamours post but they'll be more coming soon.
Found this post useful? Kindly tap the up vote button below! :)