Running Python from the terminal is often unavoidable. However, if you just installed Python on Windows 10 for the first time, running it via the Windows Terminal is only possible if it’s added to the Windows PATH environment variable.

How to Add Python to the Windows Path-Featured

It can seem tricky to do, but it’s nothing to fear. To help you overcome the twists involved in adding Python to the Windows PATH after installing it, let’s take a look at the options and the few steps involved.

Why Add Python to Windows PATH?

If you fail to add Python to the PATH on your Windows OS, you can’t run the Python interpreter, start a virtual programming environment,  or run commands like pip install from the terminal.

That’s because, when you run any non-default program from the command line, the machine looks for an executable in the current folder, or in the Windows PATH.

If it’s not in the PATH variable, the terminal returns a “command not found” error. Adding to the PATH is powerful, even if you’re executing a command from a created or default batch file, adding its parent execution file to the PATH variable makes it callable from the terminal as well.

How to Manually Add Python to the Windows PATH

First off, if you’ve not installed Python on your machine, go to the website to download and install your preferred version.

Once Python is successfully installed on your PC, check if it’s already added to the Windows PATH. Open up your terminal and type python, then hit the Enter key. The command might return an error that says “‘python’ is not recognized as an internal or external command, operable program or batch file,” indicating that Python isn’t added to your machine’s PATH variable yet.

To execute Python programs from your command line, follow the steps highlighted below.

Find Python’s Installation Path on Your PC

To add Python to your Windows PATH, you need to get its installation path. To do that, open up the Windows search bar and type python.exe (don’t hit the Enter key). Then right-click on Python.exe that pops up in the resulting menu and select the Open file location option.

Find Python installation path via Windows search bar

In the Explorer windows that opens, click on the long directory bar to the left of the search bar. Highlight and copy the entire path text to your clipboard with Ctrl + c. Then continue with the next steps below.

Copying Python installation path

Next: Add Python to PATH in User Variables

To add Python to the PATH in User variables, right-click on This PC, and select Properties. Once in the properties menu, click on the Advanced system settings option. In the next window, select the Advanced tab, and select Environment Variables.

Getting to the Environment Variables

The Environment Variables menu has two distinct parts: an upper part called User variables, and a lower part named System variables. However, our focus is on the User variables in this case.

Within the User variables menu, locate a variable called Path. Then paste the path you copied earlier in the Variable value option using Ctrl + v and click Ok.

However, if you can’t find that variable, you might need to create it. To do that, click on New. Next, in the Variable name form, type Path, and paste your Python path in the Variable value field.

Creating a new path in Users variables

Go back to your Python installation path folder and double-click on Scripts to open that directory. Next, copy its path from the path bar at the upper part of the windows (besides the search bar), just like you did earlier for the Python installation path.

Once you’ve copied the Scripts path, head back to the Environment Variables. Next, select the Path variable and click on Edit. Type a semi-colon after your Python executable path and paste the Scripts path you just copied after it. Then click Ok.

Add the Scripts directory path to the Users variable path

Adding Python to the PATH With the System Variables Option

You can add Python to the System Variables PATH as well. Although this is just an alternative, and it’s not necessary if you’ve added it in the Users variables already.

To use the System Variables option, follow the steps highlighted above for copying the Python path and its Scripts path. Then head back into the Environment Variables. Then, inside the System Variables segment, locate a variable called Path. Click on that variable and click on Edit.

In the next window that comes up, click on New and paste the path you copied earlier in the opened space. Repeat that process for the Scripts path as well. Next, click Ok and close the Environment Variables window.

Adding python to path in System variables

Add Python to Windows PATH Automatically

You can add Python to the Windows PATH automatically during installation as well. Although using this method doesn’t work in all cases, you can still give it a try.

To do that, click on your installation file and check the Add Python 3.7 to PATH box. The version number will change when installing different versions of Python.

Checking that box adds Python to your Windows PATH automatically. That means you can start running Python commands via the command line immediately after installation.

Adding python to path automatically during installation

Confirm That Python Is Added to Windows PATH

To see if Python is already added to the Windows PATH, open the terminal and type python –version, then hit the Enter key. If the command returns the currently installed version of Python, it means you’ve successfully added it to the Windows PATH.

However, to check if you’ve added the Scripts directory to the Windows PATH, try to run pip install package on the terminal, replacing “package” with your preferred library. If you’ve installed Python 2.7.9 and above, the command installs the named package, indicating that you’ve successfully added Python’s Scripts to the path as well.

Confirm that python is added to path via the terminal

Related: How to Install Python Pip on your PC

Other Program You Should Consider Adding to the Windows Path

In addition to adding Python to the Windows PATH, you can add text editors, Integrated Development Environments (IDEs), Git, Node, Anaconda, and many other programs.

For instance, managing a project with Sublime Text is easy when you open the terminal to the directory of your project folder and run the subl . command. This opens the editor in your current folder and displays it in the sidebar, another time-saving shortcut for working productively with Sublime Text.

About The Author


Original Content

Website Source


Please enter your comment!
Please enter your name here