by @kodeazy

python is not recognized as an internal or external command.

Home » Python » python is not recognized as an internal or external command.
  • I had installed python 3.10.1 but when I try to execute python command in command prompt I am getting the below error.

Error Image

  • To resolve the problem first get the path of python by executing the below command in command prompt.

    py -c "import os, sys; print(os.path.dirname(sys.executable))"

    Below is my path after executing the command

    C:\Users\JOHN\AppData\Local\Programs\Python\Python310
  • Now added the path in environment variable by creating a new variable as below.

Environment Variable

  • Now after restarting the PC try executing the python command as below.

Error Resolved Image