Python 3.12 installation on Windows

Hi, I am trying to open the newly installed Python 3.12 on my PC , and got this error:

Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

How do I fix this, please?

Welcome!

You should find that these docs will help you 4. Using Python on Windows — Python 3.12.0 documentation

If you are still having issues ask here.

1 Like

Modern versions of Windows try to help the user with installing Python. Unfortunately, Microsoft’s approach does not cooperate very well with how Python expects to manage itself - even after trying to coordinate on the problem, and even though a few years have passed.

The short version is that Python installers do not normally put the new Python onto the system’s PATH, because that can cause other problems, and because it is not necessary for making the Python Launcher for Windows work. This means that python will end up finding Microsoft’s own wrapper program, which is not actually a Python interpreter, but instead their own advertising for the Microsoft Store distribution of Python. Try using py instead.

You can find more information here:

Hello,

have you tried re-installing Python?

Once you have downloaded it, in the Windows search entry, type: idle and hit enter. It should come up in the list of apps installed. Here are a few additional notes:

To update pip version:

python.exe - m install --upgrade pip

Notes for installing python libraries:

  1. Open the Command Prompt
  2. Type: pip install ‘library_name_here’

If for some reason you get an error when installing new modules (aka libraries), make sure
that you have the correct path defined. For example, I just updated my IDLE version from 3.11.5 to version 3.12. When I attempted to run some of my code snippets, I was getting an error that I did not have the modules installed. The issue was that the path was pointing to my prior path pertaining to the 3.11.5 version. To rectify the issue, the PATH needed to be updated to the new v3.12 folder path. Note that after updating the PATH, you will have to reboot your computer in order for your changes to take effect.

Here are the instructions to update the PATH when downloading new modules:

  1. Make sure the PATH is properly defined. You can check this by going to the Control Panel:

    Control Panel > System and Security > System>About
    Click on: Advanced system settings
    Click: Environment Variables
    Check that the ‘User variables’ are correct.

This is unnecessary if you use the py command in place of python

Like this

py -m pip install <package>

Thank you for this. I will add this to my python notes. :smiley:
By the way, I was not aware that you could install python this way. I usually went to the website for python package download (Windows version). Does this instruction automatically know which OS you have?

The python.org web site knows your OS from information that the browser sends (likely the User-Agent HTTP header). And can use that to ofter a compatible download.

1 Like

Thank you.

Much appreciated! :handshake: