Running Python from the terminal is often unavoidable.

It can seem tricky to do, but it’s nothing to fear.

Why Add Python to Windows PATH?

How to Add Python to the Windows Path-Featured

If it’s not in the PATH variable, the terminal returns a “command not found” error.

Open up your terminal and typepython, then hit theEnterkey.

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

Find Python installation path via Windows search bar

To do that, open up the Windows search bar and typepython.exe(don’t hit theEnterkey).

Then right-click onPython.exethat pops up in the resulting menu and select theOpen file locationoption.

In the Explorer windows that opens, grab the long directory bar to the left of the search bar.

Copying Python installation path

Once in the properties menu, press theAdvanced system settingsoption.

In the next window, select theAdvancedtab, and selectEnvironment Variables.

TheEnvironment Variablesmenu has two distinct parts: an upper part calledUser variables, and a lower part namedSystem variables.

Getting to the Environment Variables

However, our focus is on theUser variablesin this case.

Within theUser variablesmenu, locate a variable calledPath.

Then paste the path you copied earlier in theVariable valueoption usingCtrl + vand clickOk.

Creating a new path in Users variables

However, if you’re able to’t find that variable, you might need to create it.

To do that, click onNew.

Next, in theVariable nameform, typePath, and paste your Python path in theVariable valuefield.

Add the Scripts directory path to the Users variable path

Go back to your Python installation path folder and double-click onScriptsto open that directory.

Once you’ve copied the Scripts path, head back to theEnvironment Variables.

Next, select thePathvariable and click onEdit.

Adding python to path in System variables

key in a semi-colon after your Python executable path and paste theScriptspath you just copied after it.

To use theSystem Variablesoption, follow the steps highlighted above for copying the Python path and its Scripts path.

Then head back into theEnvironment Variables.

Adding python to path automatically during installation

Then, inside theSystem Variablessegment, locate a variable calledPath.

press that variable and click onEdit.

Repeat that process for theScriptspath as well.

Confirm that python is added to path via the terminal

Next, clickOkand close theEnvironment Variableswindow.

To do that, select your installation file and check theAdd Python 3.7 to PATHbox.

The version number will change when installing different versions of Python.

Checking that box adds Python to your Windows PATH automatically.

That means you might start running Python commands via the command line immediately after installation.