Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'python' is not recognized as an internal or external command [duplicate]

Tags:

python

cmd

People also ask

How do you fix Python is not recognized as an internal or external command?

Specify the full location to python.exe One way to fix the error would be to launch Python from the Command Prompt by passing in the full path to the executable file each time you wanted to run Python. In other words, instead of typing Python you would type something like C:\Users\me\path\to\python.exe .


Try "py" instead of "python" from command line:

C:\Users\Cpsa>py
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>


I have found the answer... click on the installer and check the box "Add python to environment variables" DO NOT uninstall the old one rather click on modify....Click on link for picture...

enter image description here


You need to add that folder to your Windows Path:

https://docs.python.org/2/using/windows.html Taken from this question.


Firstly, be sure where your python directory. It is normally in C:\Python27. If yours is different then change it from the below command.

If after you install it python still isn’t recognized, then in PowerShell enter this:

[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")

Close PowerShell and then start it again to make sure Python now runs. If it doesn’t, restart may be required.

enter image description here


Type py -v instead of python -v in command prompt


If you want to see python version then you should use py -V instead of python -V

C:\Users\ghasan>py -V

Python 3.7.1

If you want to go to python's running environment then you should use py instead of python

C:\Users\ghasan>py

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

Here you can run the python program as:

print('Hello Python')

Hello Python