Why is python -version not working in cmd prompt?

i have python installed but nein work

Try two dashes instead of one. If the option is multiple letters, it needs multiple dashes.

still im getting

Python was not found;

This is due to system path. You need to add the python path to system path.

That, or try python3 instead.

When you are using Windows, the command of then is py. Try py –version, especially if you got Python from the Microsoft store. As others here said though, adding Python to the PATH should make things easier for you later on.

Use Windows Control Panel to add the Python.exe to your System Path for your user.

Path: Control Panel > Edit the System Environment Variables > on the Advanced tab click Environment Variables button > In the top pane click “New” button. Add variables for PYTHONPATH and PYTHONHOME.

You probably need to reboot after doing this.

Also when I run Windows Terminal (recommended for Python as it is much more configurable) I always open a batch file I call “addpath.bat” which also adds the python directories to the PATH variable. I think you may have to install Windows Terminal (wt) separately even with Win 11 (which I have).

I’m pretty sure that you just need a new shell to see the changes. A complete reboot is not necessary.

That’s good to know. I’m not familiar with Windows internals. But I like to reboot because Win 11 is so bloated and buggy.