'python3' is not recognized as an internal or external command, operable program or batch file

Python 3.xPython 3.5

Python 3.x Problem Overview


I am using Python 3.5.2 version on Windows 7 and tried using python3 app.py. I am getting this error message:

'python3' is not recognized as an internal or external command,
operable program or batch file. 

Is there any specific cause about why the python3 command is not working?

I also verified that the PATH is added to environment variables.

Python 3.x Solutions


Solution 1 - Python 3.x

There is no python3.exe file, that is why it fails.

Try:

> py

instead.

py is just a launcher for python.exe. If you have more than one python versions installed on your machine (2.x, 3.x) you can specify what version of python to launch by

> py -2 or > py -3

Solution 2 - Python 3.x

You can also try this: Go to the path where Python is installed in your system. For me it was something like C:\Users<USER>\Local Settings\Application Data\Programs\Python\Python37 In this folder, you'll find a python executable. Just create a duplicate and rename it to python3. Works every time.

enter image description here

Solution 3 - Python 3.x

Python3.exe is not defined in windows

Specify the path for required version of python when you need to used it by creating virtual environment for your project

Python 3

> virtualenv --python=C:\PATH_TO_PYTHON\python.exe environment

Python2

> virtualenv --python=C:\PATH_TO_PYTHON\python.exe environment

then activate the environment using

> .\environment\Scripts\activate.ps1

Solution 4 - Python 3.x

If python2 is not installed on your computer, you can try with just python instead of python3

Solution 5 - Python 3.x

In my case I have a git hook on commit, specified by admin. So it was not very convenient for me to change the script (with python3 calls).

And the simplest workaround was just to copy python.exe to python3.exe.

Now I could launch both python and python3.

Solution 6 - Python 3.x

Yes, I think for Windows users you need to change all the python3 calls to python to solve your original error. This change will run the Python version set in your current environment. If you need to keep this call as it is (aka python3) because you are working in cross-platform or for any other reason, then a work around is to create a soft link. To create it, go to the folder that contains the Python executable and create the link. For example, this worked in my case in Windows 10 using mklink:

cd C:\Python3
mklink python3.exe python.exe

Use a (soft) symbolic link in Linux:

cd /usr/bin/python3
ln -s python.exe python3.exe

Solution 7 - Python 3.x

> For Python 27

virtualenv -p C:\Python27\python.exe django_concurrent_env

> For Pyton36

 virtualenv -p C:\Python36\python.exe django_concurrent_env

Solution 8 - Python 3.x

Enter the command to start up the server in that directory: py -3.7 -m http.server

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGaurav ShuklaView Question on Stackoverflow
Solution 1 - Python 3.xVlad BezdenView Answer on Stackoverflow
Solution 2 - Python 3.xuser11617036View Answer on Stackoverflow
Solution 3 - Python 3.xHaTiMSuMView Answer on Stackoverflow
Solution 4 - Python 3.xJerinView Answer on Stackoverflow
Solution 5 - Python 3.xStanislavView Answer on Stackoverflow
Solution 6 - Python 3.xK FView Answer on Stackoverflow
Solution 7 - Python 3.xUmar AsgharView Answer on Stackoverflow
Solution 8 - Python 3.xYOOGView Answer on Stackoverflow