DEV Community

PyLenin
PyLenin

Posted on

What if you forget to add Python to the PATH variable?

If you forget to add Python to the PATH, you won't be able to run Python in your command line from any other directory.

You will get a message saying,

'python' is not recognized as an internal or external command.

This is because Windows is trying to search for Python in its PATH variable and is unable to find it.

Here is a step-by-step instruction to add Python to the PATH variable in Windows 10.

  1. Copy the directory to which Python is being installed.
  2. Search for System Properties in the Search Bar.
  3. Click on the "Environment Variables" button in System Properties.
  4. Click on the "Path" variable and then click on "Edit".
  5. Now here's the deal. Pay Attention! Paste the directory path from Step 1 at the top of the list. You can use the "Move up" button to get it to the top. Now click on "Ok".

Now you can open up your command line and run python. The Python interactive shell will open up.

*Here is a little extra tip! *

Add the Scripts folder to the PATH variable too. This is the folder where all your libraries will be installed.

If the instructions are not clear enough for you, you can also check out the visual guide containing images of every step, on my blog for achieving the above objective.

Good luck and let me know!

Top comments (0)