2

Overview

My exact goal is to set my preferred version of python as the default when I type python3 into a command prompt or powershell prompt. I've tried everything but can't figure it out.

I have the following Python versions installed (Output of py -0p):

 -V:3.14[-64]    C:\Users\user\AppData\Local\Python\pythoncore-3.14-64\python.exe
 -V:3.13[-64] *  C:\Users\user\AppData\Local\Python\pythoncore-3.13-64\python.exe
 -V:3.12[-64]    C:\Users\user\AppData\Local\Python\pythoncore-3.12-64\python.exe

I've set the following environment variables system-wide, and for my user account:

PY_PYTHON                        = "3.13"
PY_PYTHON3                       = "3.13"
PYTHON_MANAGER_DEFAULT           = "3.13"
PYTHON_MANAGER_DEFAULT_PLATFORM  = "-64"
PYTHONUTF8                       = "1"

Unfortunately when I type python3 into a command prompt, it launches the python 3.14 shell.

How can I ensure that when I enter python3 in a CLI prompt that it launches my preferred version of python (3.13)?

Additional Info:

I've disabled two of the app execution aliases in my Win11 settings hoping this might solve the issue:

AppExecutionAliases

But it's not working.

Can someone point me in the right direction? Thanks in advance for any help!


Edit

Information about the Python Install Manager

Documentation Here

  • The Python Install Manager automatically creates a folder of hardlinks (aliases) to installed Python runtimes in the following folder: %LocalAppData%\Python\bin.
  • That resolves to C:\Users\user\AppData\Local\Python\bin

Inside of this folder is the following (On my system):

C:\Users\user\AppData\Local\Python\bin\chardetect.exe
C:\Users\user\AppData\Local\Python\bin\dotenv.exe
C:\Users\user\AppData\Local\Python\bin\f2py.exe
C:\Users\user\AppData\Local\Python\bin\fastapi.exe
C:\Users\user\AppData\Local\Python\bin\hf.exe
C:\Users\user\AppData\Local\Python\bin\httpx.exe
C:\Users\user\AppData\Local\Python\bin\isympy.exe
C:\Users\user\AppData\Local\Python\bin\jsonschema.exe
C:\Users\user\AppData\Local\Python\bin\markdown-it.exe
C:\Users\user\AppData\Local\Python\bin\mcp.exe
C:\Users\user\AppData\Local\Python\bin\normalizer.exe
C:\Users\user\AppData\Local\Python\bin\numpy-config.exe
C:\Users\user\AppData\Local\Python\bin\parse_pip_search.exe
C:\Users\user\AppData\Local\Python\bin\pip.exe
C:\Users\user\AppData\Local\Python\bin\pip3.exe
C:\Users\user\AppData\Local\Python\bin\pygmentize.exe
C:\Users\user\AppData\Local\Python\bin\pyproject-build.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-decrypt.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-encrypt.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-keygen.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-priv2pub.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-sign.exe
C:\Users\user\AppData\Local\Python\bin\pyrsa-verify.exe
C:\Users\user\AppData\Local\Python\bin\python.exe
C:\Users\user\AppData\Local\Python\bin\python3-64.exe
C:\Users\user\AppData\Local\Python\bin\python3.12-64.exe
C:\Users\user\AppData\Local\Python\bin\python3.12.exe
C:\Users\user\AppData\Local\Python\bin\python3.13-64.exe
C:\Users\user\AppData\Local\Python\bin\python3.13.exe
C:\Users\user\AppData\Local\Python\bin\python3.14-64.exe
C:\Users\user\AppData\Local\Python\bin\python3.14.exe
C:\Users\user\AppData\Local\Python\bin\python3.exe
C:\Users\user\AppData\Local\Python\bin\pythonw.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3-64.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.12-64.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.12.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.13-64.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.13.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.14-64.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.14.exe
C:\Users\user\AppData\Local\Python\bin\pythonw3.exe
C:\Users\user\AppData\Local\Python\bin\pywin32_postinstall.exe
C:\Users\user\AppData\Local\Python\bin\pywin32_testall.exe
C:\Users\user\AppData\Local\Python\bin\tiny-agents.exe
C:\Users\user\AppData\Local\Python\bin\torchfrtrace.exe
C:\Users\user\AppData\Local\Python\bin\torchrun.exe
C:\Users\user\AppData\Local\Python\bin\tqdm.exe
C:\Users\user\AppData\Local\Python\bin\transformers.exe
C:\Users\user\AppData\Local\Python\bin\typer.exe
C:\Users\user\AppData\Local\Python\bin\uvicorn.exe
C:\Users\user\AppData\Local\Python\bin\wsdump.exe
  • All of these hardlinks / aliases point to their corresponding runtimes. But the more general aliases python.exe, python3.exe, and python3-64.exe seem to get set to the latest installed python version.

  • Using LinkShellExtension I can see in the link properties page that the first few entries for python3.exe are:

C:\Users\user\AppData\Local\Python\bin\python3.14.exe
C:\Users\user\AppData\Local\Python\bin\python3.14-64.exe
C:\Users\user\AppData\Local\Python\bin\python3.exe

Don't ask me why python3.exe is hardlinked to itself, I have no clue why.

So, unless I'm missing some kind of setting or configuration option, there seems to be no way to specify a default version of python that gets invoked when you enter python3 or python3-64 into a command prompt.

It simply defaults to the latest version of Python you have installed.

Fortunately, this is NOT the case for python.exe. If I type python into a command prompt or powershell prompt, it correctly opens my preferred version 3.13 (PY_PYTHON3 and PY_PYTHON values).

I would be really stoked if someone could prove me wrong here though.

More Information about my PATH environment variables

Here is what I have in PATH (Machine):

  • C:\Users\user\AppData\Local\Python\bin
  • C:\Users\user\AppData\Local\Python\pythoncore-3.13-64\Scripts

I do not have C:\Users\user\AppData\Local\Python\pythoncore-3.13-64 added to PATH, because it wouldn't matter anyway since that folder only contains a python.exe binary, and I'm already getting my desired version to launch when I run python in the command prompt via pymanager aliases.

A more direct re-phrase of my original question

Is it possible to make the Python Install Manager create an alias of python3 and python3-64 in C:\Users\user\AppData\Local\Python\bin that points to my PREFERRED version of Python first, instead of the most recent Python version?

Am I stuck with just running python <args> or py -3.13 <args>?

If I'm missing something, any informed response would be greatly appreciated.

1
  • 1
    Have you checked your PATH? Commented Mar 10 at 8:58

1 Answer 1

2

How can I ensure that when I enter python3 in a CLI prompt that it launches my preferred version of python (3.13)?

  1. By altering the environment variable named PATH so that it includes
    C:\Users\user\AppData\Local\Python\pythoncore-3.13-64
    earlier in the path than the location of any other versions of python. Ideally it would be the only occurrence in PATH of a location of a Python version. The others should be omitted. Or ...

  2. By removing any Python locations from PATH and creating a python3.cmd file in a location in PATH. For example, I have a scripts folder in my home directory that I include in my PATH. The python3.cmd can temporarily adjust PATH if python needs it to e.g find libraries etc.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.