Python is widely used most powerful high level programming language. It is very user friendly and easy to learn. Python 3.x is available for Windows, MacOS X and most of the distributions of Linux operating system. Even though Python 2.x is available for many other OSs. Let’s see how to set up our Python environment for windows.
Installing Python on Windows
Before you start programming, you need to setup environment. You simply visit http://www.python.org/download to get the most recent version of Python.
To install Python on a Windows machine, follow these steps:
- Open a Web browser and go to https://www.python.org
- Click the “Download” link.
After downloading the installer from the official website. Click on installer and on the dialogue box, enable the “Add Python 3.8 to PATH” option and then click on Install Now.
Note : As you chose “Add Python 3.8 to PATH” during installation then you do not need to set environment variables manually.
As you click on Install Now button, then python installation will begin and it will finish in couple of minutes.
Next, you have to make a decision . Clicking the “Disable path length limit” option removes the limitation on the MAX_PATH variable. This change won’t break anything, but will allow Python to use long path names. Although it is not mandatory.
Manually Adding Python to Windows Path
Let’s suppose you forget to chose adding python in PATH during installation then you have to add it manually. Let’s see how can we set environment variables?
Click on Start on windows, type “advanced system settings” and then select the “View advanced system settings” option. In the “System Properties” window that opens, on the “Advanced” tab, click the “Environment Variables” button.
That should take you to the Environment Variables screen, where you can add/edit your paths. Click on ‘New…‘ to add the ‘Path’ variable (note that if your ‘Path’ variable already exists, then click on ‘Edit…’ instead).
Then you should see the following dialogue box, which will allow you to add/edit variables:
Before you enter any values, you’ll need to locate the relevant Python paths as Python application path (folder where you originally installed Python) and Python Scripts path (Scripts folder should be located within the Python application path).
Here my Python application path looks like:
And my Python Scripts path looks like:
Next let’s enter the New User Variable box that you got earlier. I will type my Python application path and Python script path separated by a semi-colon (;).
Press ‘OK‘ and you would then see your new Python Path under the ‘User variables‘ section. Don’t forget to press ‘OK‘ again so that the changes will get implemented.
That’s it! You just added Python to the Windows Path.
Hence, you successfully installed and setup Python 3.8 into your windows machines. In our upcoming tutorial you will learn how to install Python on Linux OS.