Skip to content
Home ยป What to do when Python is not recognized as an internal or external command

What to do when Python is not recognized as an internal or external command

  • by
  • 2 min read

One of the main reasons I prefer R(Studio) over Python for doing data science in a context of business intelligence is the ease and stability of the workspace: no virtual environments to maintain since most popular libraries have matured. An update once a year suffices. Yet I acknowledge Python is a lot faster and more versatile. In this short post I discuss an error all new Python aspirants run into.

‘python’ is not recognized as an internal or external command, operable program or batch file.

If you’re sure you installed Python and you get this error, here’s what went wrong: you forgot to add Python to the PATH variable during the installation process.

What is the PATH variable. To cite Wikipedia: it’s a “a set of directories where executable programs are located.” In other words, Python is an application (.exe) and you need to tell your computer what you mean when you type python in a terminal.

Two things you can do. The first is reinstalling Python and checking the checkbox. The second is taking these easy steps to add Python to your PATH variable.

  1. Go to This PC
  2. Right click somewhere (not a folder)
  3. Click Properties
  4. Click Advanced System Settings
  5. Click Environment Variables
  6. Double-click the value of the Path variable in the System variables
  7. Click New
  8. Type the directory of where you installed Python

Congratulations, you can now run Python from the command prompt and PowerShell.

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

Leave a Reply

Your email address will not be published. Required fields are marked *