Welcome to the First Step toward python programming. In this section, we will guide how to install Python on different operating system step by step.
In this section, we will see how to install Python in windows, mac, Linux, and Android devices. So, let's start with the first operating system, and that is windows.
Install Python 3 on Windows:
Windows don't offer a default python interpreter, so you have to download it by yourself. To download Python on the Windows operating system, a user must have to get it from an authenticated source, and that is from the authorized website of Python.
The link to that site is (https://www.python.org/).
At the top of the page, you can find a link to the latest python binary file, or you can directly go to the following link - click the image.
After clicking the link, scroll down the page and select a binary file according to your operating system. Select either Windows x86-64 executable installer for a 64-bit operating system or windows x-86 executable installer for a 32-bit operating system.
If your system is the 32-bit operating system, then you have to choose the 32-bit executable file, but if your system is 64-bit, then you have a choice, either you can choose 64-bit or 32-bit. 32-bit is light in weight, but 64-bit is capable of performing large computations.
After the executable is installed, click on the exe file and follow the instructions. Don't change the default paths as it will lead to contradictions between modules and the python interpreter. Remember to click on "Add to Path" before clicking to the install now button, as shown in the image.
A few minutes later, you will have a working python interpreter. Search in the menu box "IDLE," and you will find the python interpreter.
Install Python 3 on Ubuntu:
Like windows, there is no need to install Python in Ubuntu. Ubuntu gives two versions of Python, Python2, and Python3. Python2 consists of the python 2.7 version, and python3 contains either python3.5 in the case of Ubuntu 16 and 17 or python3.6 in the case of Ubuntu 18.
In the case of Ubuntu 16 and 17, you can upgrade to Python 3.6 by running the following commands.
sudo apt-get update
To check the version of your Python, you can run the command as follows.
Install Python 3 on macOS:
To install the Python on macOS, just run the command in a terminal.app
|homebrew install python3|
This will download the latest Python in a system. After the download is finished, run, make sure it is downloaded successfully by writing in command python3.
Install Python 3 on Android / IOS:
Students can install Python on their Android devices by installing a "PyDroid" application on their devices. The terminal will then be installed automatically, and the user can easily run their program on python mobile.
For the IOS user, the Pythonista app is a full-fledged app that can be run iPhone and iPads. It contains the terminal and documentation all in one place.
There are online editors too that can be used for initial programming and to run and execute small programs like:
- Python anywhere
- Python.org console
But keep in mind that these consoles are not meant for running big programs, and even they don't save your programs.
Types of Editors:
There are lots of editors in the market on which you can run and execute python programs. Each editor has its own pros and cons. Let's have a look at different editors that can be used to execute Python programs.
Idle is the built-in editor of Python in windows. It is very light in weight and can easily understand. It gives both a command-line functionality as shown in the image or writes code in a file then execute it. It can perform all the major functionality that a giant can do.
But the bad aspect of using idle is we cannot manage multiple files with idle.
Moreover, IDLE doesn't provide intelli-sense that is the detection of errors while writing and giving predictions about modules. It is pre-installed in windows along with the installation of Python. To install on Linux, run the following command:
|sudo apt-get install idle3|
PyCharm is one of the powerful IDE. It has two types of editions that are community edition and Professional edition. The community edition is free to use, but the Professional edition is not free.
It is best suited for web programming. It provides a built-in terminal, which makes it handier to use. We can run servers from within the terminal and make changes in the codes to see the changes.
But the drawback of PyCharm does not provide all the functionalities in the community version. For that, you have to buy a professional version. Moreover, it is too heavy to use. It took too long on a device that has low RAM.
The jupyter notebook is very popular among the data scientist community. It is fast, easy to use, and there is no need to execute all the code again and again. This IDE is specially designed for data analysis and machine learning processes because, in data analysis, we have to upload data that is big in size and took a few seconds to load.
It is not a very good approach to run and load the data again and again. Jupyter notebook allows us to run and execute the code cell by cell, and then it stores the values of each cell in memory, so we don't have to execute it again.
But we cannot do programming in which many files are managed like web programming. This IDE is only meant for data analysis and model training.
Visual Studio Code:
When it comes to web programming, nothing is better than VS Code. It has all the functionalities that PyCharm has. It gives a terminal which is useful for making commands and running server. The user doesn't have to open a separate terminal.
The code can be maintained within the IDE. By installing an external python package, it provides a good intellisense and code suggestions. Moreover, we can enable PEP8 that ensures good coding practice. It is light in weight and very easy to use.
If you don't want to install anything on your system and want to code from a web browser, then CodeAnywhere is one of the best web-based editors for you. The best thing is that from this web-based tool, you can code from anywhere. Right now, many multi-national companies are using CodeAnywhere.
In this section, we have discussed in detail how to install Python in different operating systems. Moreover, we have discussed the pros and cons of different IDE's. These IDE's can be download from their respective site.
Moreover, we will discuss how to download these IDE's in a later section. At the start, we will use IDLE for not making things complicated at the start. That was all for today. We will meet in the next section.