I have python 3.1 installed, and I have added it to the system path too. Now I can open "cmd" and type python to start python, but whenever I try to open cmd in a specific directory by using (shift + right click -> open command prompt here), and type python, it says "command not found"!
How can I fix this?
To start a Python interactive session, just open a command-line or terminal and then type in python , or python3 depending on your Python installation, and then hit Enter .
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.
The solution I use is to create a bat file. When you run the bat file it will run the python program and pause at the end to allow you to read the output. Then if you press any key it will close the window. Save this answer.
Enter the "python" command and your file's name. For example, if your Python file is named "script", you would type in python script.py here. If your Python file has one or more spaces in its name, you'll place quotation marks around the file name and extension (e.g., python "my script.py" ).
Right click on my computer>got to properties>advanced settings>environmental variables>
choose path and add the installed python dirtory to that path as like below:
C:\WINDOWS\system32;C:\WINDOWS;C:\Python27
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