0

It seems my default python is v3.11 (indicated by the asterisk when doing command line "py -0p") and yet at the same time it says it's v3.10 (command line "python --version") and v3.10 is also the version it opens by default via command line.

I've updated the environment variables (PY_PYTHON and Path) to point to v3.11, as well as the registry setting Computer\HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command, but still no joy.

Anyone any idea what else might be affecting this?

see the conflicting command line results here

Sia
  • 1
  • 3

2 Answers2

0

The easiest way to switch to the newest version is to uninstall the older ones but if you want to keep them, try restarting your cmd.

Jan
  • 50
  • 6
  • I already restarted my cmd (I'm aware it doesn't refresh after changes) and I already did an uninstall and reinstall, but I'll remove just v3.10 and see if that works, thanks. – Sia Nov 21 '22 at 17:18
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '22 at 05:45
0

In case this helps anyone else, here are the steps I took to fix my issue:

  1. To check what versions of Python you have installed type in the command line (NB: your default version will have an asterisk next to it): py -0p

  2. If you wish to upgrade Python, you can do it using the Chocolatey Package Manager, see details here: https://linuxhint.com/update-python-windows/

  3. To check the default version has botocore installed, you can see all packages for it by typing in the command line (changing your version number as appropriate): pip3.11 list

  4. You can install botocore on a specific version of Python via command line, e.g. pip3.11 install botocore

  5. Check to see if the Python Launcher has the default set to open the correction version of Python (i.e. with botocore installed) by typing: python –version

  6. To change the default version, ensure you have the variable PY_PYTHON with the correct version number as the value (e.g. 3.11) under System Properties>Advanced>Environment Variables.

  7. Also under System Properties>Advanced>Environment Variables>Path, ensure you have a path to the Python exe you want to use and move it to the top of the list to ensure it takes priority.

  8. If you still don’t have the correct version set as the default, follow the steps found here: https://www.infoworld.com/article/3617292/how-to-use-pythons-py-launcher-for-windows.html

  9. If it’s still not working, change the registry setting HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command by adding the following characters to the end if they don’t already exist %" For example: "C:\Python311\python.exe" "%1" would become "C:\Python311\python.exe" "%1" %" (Ensure you type or copy the speech mark from your current value rather than from here in case it’s using a different char)

  10. If still no joy, see here for other registry settings that may work for you: Windows is not passing command line arguments to Python programs executed from the shell

  11. If that doesn’t work, ensure you have the environment variables PYTHONHOME and PYTHONPATH set correctly (see What exactly should be set in PYTHONPATH?)

Sia
  • 1
  • 3