When I type python
into the command line, the command prompt says python is not recognized as an internal or external command, operable program, or batch file
. What should I do?
Note: I have Python 2.7 and Python 3.2 installed on my computer.
The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.
Open Command Prompt and type “python” and hit enter. You will see a python version and now you can run your program there.
The most common cause of this error is the PYTHONPATH and PYTHONHOME environment variables. You can see what environment variables are set by the "set" command.
py is itself located in C:\Windows (which is always part of the PATH ), which is why you find it. When you installed Python, you didn't check the box to add it to your PATH , which is why it isn't there. In general, it's best to use the Windows Python Launcher, py.exe anyway, so this is no big deal.
I have installed the latest Python for Win10 from Releases for Windows. Just typing py
in the Command Prompt Window
starts Python.
Microsoft Windows [Version 10.0.15048] (c) 2017 Microsoft Corporation. All rights reserved. C:\Users\sg7>py Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>`enter code here`
Testing:
>>> print("hello!") hello! >>>
Please be aware that in my case Python was installed in C:\Users\sg7\AppData\Local\Programs\Python\Python36>
directory
C:\Users\sg7\AppData\Local\Programs\Python\Python36>dir Volume in drive C is Windows7_OS Volume Serial Number is 1226-12D1 Directory of C:\Users\sg7\AppData\Local\Programs\Python\Python36 08/05/2018 07:38 AM <DIR> . 08/05/2018 07:38 AM <DIR> .. 12/18/2017 09:12 AM <DIR> DLLs 12/18/2017 09:12 AM <DIR> Doc 12/18/2017 09:12 AM <DIR> include 12/18/2017 09:12 AM <DIR> Lib 12/18/2017 09:12 AM <DIR> libs 10/03/2017 07:17 PM 30,334 LICENSE.txt 10/03/2017 07:17 PM 362,094 NEWS.txt 10/03/2017 07:15 PM 100,504 python.exe 10/03/2017 07:12 PM 58,520 python3.dll 10/03/2017 07:12 PM 3,610,776 python36.dll 10/03/2017 07:15 PM 98,968 pythonw.exe 08/05/2018 07:38 AM 196,096 Removescons.exe 08/05/2018 07:38 AM 26,563 scons-wininst.log 08/05/2018 07:38 AM <DIR> Scripts 12/18/2017 09:12 AM <DIR> tcl 12/18/2017 09:12 AM <DIR> Tools 06/09/2016 11:53 PM 87,888 vcruntime140.dll 9 File(s) 4,571,743 bytes 10 Dir(s) 20,228,898,816 bytes free
When I am at C:\Users\sg7>
directory level python
can be invoked by typing AppData\Local\Programs\Python\Python36\python
C:\Users\samg>AppData\Local\Programs\Python\Python36\python Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
Newer Python 3.7 will be installed at: C:\Users\YourUserNameHere\AppData\Local\Programs\Python\Python37
If you wish you can add to your path environment variable: %USERPROFILE%\AppData\Local\Programs\Python\Python36
It finally worked!!!
I needed to do things to get it to work
I had to add these to both for it to work.
If I added any subdirectories, it did not work for some reason.
Thank you all for your responses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With