Python doesn’t need any introduction. Being one of the most used programming languages in the world, Python is working on almost all of our devices in one way or another. When you want to start programming in Python, it is necessary to make sure that it is currently installed and ready to run Python scripts. In order to do that, you should install Python. But sometimes, it will not be enough on Windows 10. Especially if you manually installed the program and accidentally forgot to add the Python path.
In this article, we are going to look at the steps required to manually add Python to your Windows PATH configuration. This will allow Python to run scripts on your OS without any complications. Without any further explanations, let’s directly dive into it.
The Easy Way
If you want an easier alternative without having to manually add the path yourself. You can simply reinstall Python using the latest packages. During the installation, it will provide you a checkbox asking “Add Python 3.7 to PATH” (The version number will change based on the version you are installing). Simply checking the box will automate the process. If you do not want to reinstall Python, follow the manual method given below.
To Add Python to the Windows PATH
Before getting started, you need to collect two paths.
- Python application path: Which is the folder where you installed Python. This is usually something like C:\Users\<your-username>\AppData\Local\Programs\Python\Python37-32.
- Python Scripts path: The scripts will be placed inside the Python application path. Which is usually C:\Users\<your-username>\AppData\Local\Programs\Python\Python37-32/Scripts.
Keep in mind that the <your-username> and Python37-32 will be different based on your username and the version of Python you installed.
Once you have these two paths, we can continue to the remaining steps.
- Right-click on This PC icon on your desktop.
- Choose Properties.
- On the left sidebar, click on Advanced system settings. It will open the System Properties window.
- At the bottom of the window, click on the Environment Variables… button. It will open the screen where you can add a new PATH.
- Click on the New button. This is where you have to add the paths we have collected.
- In the Variable name box, just type Path.
- In the Variable value box, you have to input both the paths we have collected separated by a semicolon. Which would look something like this.
- Click on OK. You will see the new path added to the section.
- Press OK once again to close the screen.
You have successfully added the Python location to your Windows PATH. Now, you will be able to run scripts and commands right from the CMD and successfully run the Python applications.