Python not found by command prompt

You have to update your windows PATH variable to add 3 directories. Just add this to the end of your path: c:\users\chuck\AppData\Local\Programs\Python\Python312\;c:\users\chuck\AppData\Local\Programs\Python\Python312\Lib;c:\users\chuck\AppData\Local\Programs\Python\Python312\Scripts

I had to add all 3 dirs to get PIP and the modules to work correctly.

Fix your path with a custom autoexec.bat

I also have a DOS cmd shortcut which puts me in my Python projects dir, and calls a custom c:\apps\autoexec.bat file.

In the shortcut this goes in the Target field: C:\Windows\System32\cmd.exe /k c:\apps\autoexec.bat

This will launch cmd.exe and execute the autoexec.bat file and stay in the cmd window.

My partial autoexec.bat file also sets up the PYTHONPATH just in case.

set PYTHONPATH=c:\users\YOURNAME\AppData\Local\Programs\Python\Python312

echo Path=%path%
echo PYTHONPATH=%PYTHONPATH%

Fix your path in Windows system config

  1. Go to Control Panel.
  2. Search for “path” without the double quotes.
  3. You should see something like “system” or “Edit the system environment variables”. Click that.
  4. A window will pop up. Cick the Advanced tab.
  5. On the bottom of the Advanced tab click “Environment variables” button.
  6. Under the area “User variables for YOURUSER” click the entry for Path, then click Edit button.
  7. Another window will pop up.
  8. Click New and add 3 entries total, one for each path I put above. Windows will string them together for you.
  9. Click OK. Click OK on Environment Variables.
  10. Close the System Properties window.

In my c:\apps directory I also have the TED.exe editor, Tiny editor, which is very small, and super handy packed with features! Get it here: TED Notepad

1 Like