Home > database >  py is not recognized as an internal or external operable program or batch file
py is not recognized as an internal or external operable program or batch file

Time:10-04

These are my environment variables:

PATH=C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\GitExtensions;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\GitExtensions;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Users\oprisvlad2\AppData\Local\Microsoft\WindowsApps;C:\Users\oprisvlad2\AppData\Local\Programs\Git\cmd;C:\Program Files\Java\jdk-17\bin;C:\Python27\Scripts;C:\Python27;C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 2.7;

The C:\Python27 and C:\Python27\Scripts are added but "py" is still unrecognized. I restarted my machine several times. I have look all over for solutions but none of them worked for me. I prefer something that works from the command prompt.

CodePudding user response:

The py.exe executable is not found in the paths specified to windows environment. py.exe is a launcher for detecting specific python installations.

Try python to launch the default python.

Make sure that the paths to the python executable file are placed before the the windows app dir, otherwise it could lead to windows triggering to-be-installed python.

C:\Python27\Scripts;C:\Python27;C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python 2.7;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Users\oprisvlad2\AppData\Local\Microsoft\WindowsApps

If you have py.exe somewhere, add the absolute path to evironment variable. Usually for newer python versions, if you install python via windows installer, the py is automatically added to the env variables.

  • Related