"python" is not recognized as an internal or external command

So, I recently installed Python version 2.7.5 and I made a few problems with it, but the problem is that when I go to cmd and type python testloop.py , I get the error:

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

I tried to set the path, but did not help.

Here is my way:

C: \ Program Files \ Python27

As you can see, my Python is installed here. I do not know what else to do. Can anyone help?

+80
python cmd
Jul 30 '13 at 17:04 on
source share
13 answers

You need to add this folder to your Windows path:

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

+35
Jul 30 '13 at 17:06
source share

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

C: \ Users \ CPSA> wow
Python 3.4.1 (v3.4.1: c0e311e010fc, May 18, 2014 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Enter “help,” “copyright,” “loans,” or “license” for more information.
→>

+210
Dec 09 '14 at 18:17
source share

I found the answer ... click on the installer and check the box "Add python to environment variables". DO NOT delete the old one, but click "Edit" .... Click the link for the image ...

enter image description here

+49
Sep 10 '16 at 16:54
source share

First, be sure where your python directory is located. This is usually in C:\Python27 . If yours is different, change it from the command below.

If Python is still not recognized after installation, type in PowerShell:

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

Close PowerShell and run it again to make sure Python is working now. If this is not the case, a reboot may be required.

enter image description here

+7
Jun 24 '16 at 7:39
source share

Type py -v instead of python -v at the command prompt

+6
Jan 08 '18 at 7:31
source share

If you want to see the version of Python, you should use py -V instead of python -V

C: \ Users \ ghasan> py -V

Python 3.7.1

If you want to go into the Python runtime, you should use py instead of python

C: \ Users \ Hasan> ru

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

Enter “help,” “copyright,” “loans,” or “license” for more information.

Here you can run the program in Python:

print ("Hello Python")

Hello python

+6
Dec 10 '18 at 13:40
source share

I solved this by running CMD in admin mode, so give it a try.

+4
Mar 02 '18 at 8:28
source share

I encountered the same problem when I install Python, and resolves when I install PATH on the system, here are the steps.

  • Go to "Control Panel" → "System"
  • Click "Advanced system settings" on the left.
  • Click "Environment Variables"
  • Find and click the Path variable
  • Click "Edit."
  • Add "C: \" to the environment variable field if you are using Windows7, then separate it with a semicolon from the existing entry. If you are using Windows10, just click "Create" to add.
  • Open a command prompt and try entering an image description here
+3
May 02 '17 at 15:52
source share

From Python docs, set PATH the way you did above.

You must install the Pythons installation directory, which will be added to the PATH of each command window when it starts. If you recently installed Python, then the dir C: \ py * command will probably tell you where it is installed; the usual location is something like C: \ Python27. Otherwise, you will be reduced to searching your entire drive

Use tools ‣ Find or click the "Search" button and find "python.exe". Suppose you find that Python is installed in the C: \ Python27 directory (the default at the time of writing), you must make sure to enter the command

Then run the Python command using the fully qualified path name to verify that this works.

0
Jul 30 '13 at 17:09
source share

Another useful but easy solution would be to reboot your computer after booting if Python is in the PATH variable. This was a mistake that I usually make when loading Python to a new machine.

0
Aug 10 '17 at 16:37 on
source share

Open CMD with administrator privileges (right-click, then run as administrator), then enter the following command:

 set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib 

Replace My_python_lib with the folder name of your installed python, as for me it was C:\python27 . Then, to check if the path variable is set, enter echo %PATH% you will see your part of Python at the end. Hence, python is now available. From this lesson

0
Jan 30 '18 at 18:01
source share

Just find out where you have these three files on your system, then copy each path and paste it into the environment variable one by one. Then click OK for everyone.

C: \ Anaconda3

C: \ Anaconda3 \ Scripts

C: \ Anaconda3 \ Library \ Bin

Then restart the Spyder kernel (left) and enter python in cmd to see if it works.

0
Mar 21 '18 at 5:13
source share

I installed Python 3.7.4. First I tried python on my command line. It was about the fact that "Python is not recognized by the command ......". Then I tried the command 'py' and it works.

My sample command:

 py hacker.py 
0
Jul 15 '19 at 10:39
source share



All Articles