Skip to main content

CHAKRAPANI GAUTAM

About Me

Install Python3 on Windows

Comments
Install Python3 on Windows
Now that you've heard of what Python is and made up your mind to give it a try, it's time to get started and prepare your system to execute your programs. Unlike the distros of Linux, Windows doesn't provide a prepackaged version of Python. But that doesn't mean that Windows users should give up the idea of using this flexible programming language or install a standalone Linux environment on their PCs. You can still have Python up and running on your machine.

In case you're looking for installing Python on Linux, you may follow the link. If you're a Windows user, you may want to know why you should switch from Windows to Linux. Though it's not necessary, still highly recommended.

Deciding the version

Unfortunately, there was a significant update to Python several years ago that created a big split between its versions. This can make things a bit confusing to newbies. But don't worry, it's not a rocket science!

You would find out the difference as soon as you visit the Download Python for Windows page. Right at the top, the page asks either to download the latest version of Python 2 or Python 3.




Now comes the million dollar question, which version to download?

Newer is always better. Right?

Well, maybe or maybe not. The right choice of version depends on your goals. There are some applications that are written entirely written in Python 2 like Blender (an animation studio), DropBox etc. which you can't run in pure Python 3 environment unless you rewrite their entire project again in Python 3.

On the other hand, if you're looking for learning Python and making your own projects from scratch, it's good that you use Python 3 as it is more modern and efficient. If you want to know more about Python versions, I would recommend visiting Python's wiki where you can read their well-written overview of the differences.

After deciding the versions you want to select, just click on the desired link and download the installer. For this post, I'll walk you through installing Python 3 for tutorial purposes.



Installing Python

Installing Python is as simple as any other software on Windows. After downloading the installer, just double-click and follow the instructions.



Click on run to provide permission to install Python.



Click on the checkbox to add Python 3.6 to PATH. This is necessary to be able to launch Python from the command line.

After that, click on Install Now to continue installation.



Click on the Close button after the installation completes.

Confirming the installation

Once the installation is complete, you can confirm whether Python is installed properly or not. Just open up the command prompt and enter the following command.

C:/Users/FedUser> python3 -v
Python 3.6.4

And BOOM! Your python installation is successful and your system is ready to run your Python scripts. Type python3 in your command line and write your first Python program.


Troubleshooting: Setting the PATH variable

This section of the post is completely optional and is targeted for those who couldn't confirm their installation from the command line. One of the possible reasons for this issue may be not clicking the "Add Python to PATH" checkbox while installation.

The PATH variable contains all the possible locations where the operating system will search for the command that you've entered on the command prompt. If it's not set to the one where Python is installed, you can't access it from the command line. So you're left with two options to choose,

  1. Go to the directory where Python is installed and then run your programs, or
  2. Set the PATH variable and access the command anywhere on the system.
Of course, the former one is tedious. So here's the guide to set the PATH for Python.

Hit the 'Start' button and type "Advanced System Settings". Select the "View advanced system settings" option. This will load a window named System Properties. Navigate to the Advanced tab and click on the "Environment Variables" button.



This will open a window named Environment Variables. Search for PATH variable in the list. Click on Edit button and append location of the directory where Python is installed, separating it from previous entries by a semicolon( ; ).



And there it is. Open the command prompt and re-verify the installation.



Now that you've successfully installed Python on your system, you're ready to dive into the Python world and tackle with whatever projects you want. In upcoming posts, I'll show you how to write a standalone python script and execute it on your systems. If you've any queries regarding the installation of Python on Windows, do let me know in comments.

Happy Programming!


Thoughts

Comments