How to Install Python?
Python is available on a wide range of platforms such as Linux, Windows, and Mac. To start coding in Python, we first need to download and install Python. So, without wasting any time let’s install Python and set up the python environment to get started.
You can get the most up-to-date source code, documentation, and news, etc. on the official website of python https://python.org/
As I said earlier, Python is available for a variety of platforms, and to install the right Python Interpreter you need to download only the binary code that is applicable for your platform.
If you couldn’t find the binary code for your platform then you will need a C compiler to compile your source code manually.
Here is a quick tutorial on installing Python on different platforms:
Install Python on Windows
Follow the steps to install Python on a windows system.
- Open the browser and visit https://www.python.prg/downloads/Follow the link for windows installer Python-XYZ.msi file where XYZ is the version you got to download.
- Note that your windows must support the Microsoft installer 2.0 to use the Python-XYZ.msi installer.
- Save the installer to your local disk and run it to find if your windows support the Microsoft installer.
- Run the installer and it Python and install wizard will show up
- Accept default settings and wait some time until the installation is complete.
Isn’t it very easy?
Install Python on UNIX/ Linux
Follow the steps to install Python on UNIX or Linux systems.
- Open the browser and visit https://www.python.prg/downloads/
- Follow the link to download the zipped code for Unix/Linux systems
- Download the file and extract it
- You are free to edit the Modules or setup page in case you want to customize any options
- Run the ./configure script
Thus Python is installed in your system’s standard location that is /usr/local/bin and all its libraries will be available at /usr/local/lib/pythonXX where XX represents the version of the python.
Install Python on Mac
Recent versions of MACs come with Python installed, but the version might be several years out of date.
So to install python on your Mac device, visit https://www.python.org/download/mac/
You can run Python in three different ways:
1. Run python with Command prompt
Once python is installed in your system, Type Python in the command line and it will open the interpreter in immediate mode. Then you can write your code and get the output.
To invoke the interpreter on your system, write as following-
$python script.py # Unix/Linux
Python% script.py # Unix/Linux
C: python script.py # windows/DOS
2. Run Python with shell
You can start coding in python with any OS system that provides the shell window or command-line interpreter.
First, enter python in the command line
A shell window will show up where you can start coding right away!
To invoke the interactive interpreter you can type:
$python # Unix/Linux
Python% # Unix/Linux
C :> python # Windows/DOS
3. Run python in an integrated Development Environment(IDE)
There is text editing software available to write python scripts. IDE is a graphical user interface that will make your coding experience easier and more amazing.
Note that when you download Python from the official site, an IDE namely IDLE will also be installed. It doesn’t offer many features but it’s a decent IDE for beginners.
Use one of the above methods to set up a Python programming environment. Once you set up the environment, try and execute all the sample programs that are available online. Also, make sure to learn theory to get an in-depth knowledge of Python and become an expert at it!