Python command in command prompt not working - libpython3.9.dll

Hello, I recently uninstalled my old Python 3.9 ms store version in orderd to install python 3.11 and to do it with the instealler and not from ms store, all done and good, interpreter seems to be working on VSCode and workes when opened directly, but when I type “python” in the command prompt it ends up telling me
“The code execution cannot proceed because libpython3.9.dll was not found.Reinstalling he programm may fix this problem”

For those who may ask, yes I have selected add python to path, i have run a repair of python 3.11 and 3.9( which I have then uninstalled using the installer with whom I tried the repair), and I have also manually checked that 3.11 appears in the path.

Does anybody has an idea about why would this behaviour be?

The store app distribution is the same build of the core interpreter and extension modules, except with a different executable that supports running as a desktop bridge app. The DLL name is thus “python39.dll”. The name “libpython3.9.dll” seems like you have a broken MSYS2 or Cygwin build of Python in your PATH. What’s the output when you run the following command?

where.exe python

I don’t really know much about msys32 nor cygwin, if not the fact that i think i had to install cygwin in the past to run Slic3r but basically never used it.

Running where.exe python I receive


The second one is the path to the actual interpreter, I’m really not sure why the first one is appearing.
I did try upgrading chololatey to the latest version through the powershell

choco upgrade chololatey

command and it seems to have worked, but not to have solver teh issue, in any way I looked inside the folder reported by the where command and there appears to be a python 3.9 interpreter there.

Check the output of choco list or choco list -i for the troublesome Python 3.9 package. Since it doesn’t work, you may as will remove it via choco uninstall <pkg name> --version <version number>.

If the file still exists after trying to uninstall the package, delete it via del "C:\ProgramData\chocolatey\bin\python.exe".

You may need administrator access to uninstall Chocolatey packages and/or delete files from “C:\ProgramData\chocolatey\bin”.

Trying what you suggested but both choco list and choco list -i give me no mention of any python except for python 3.11 as something not managed by chololatey, but I followed the second suggestion( manually deleting python.exe from chololatey/bin through an elevated prompt) and now the alias seems to be working in any prompt, opening the 3.11

Thanks a lot for the help