You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

多Python版本共存困惑及未安装CPython被uv venv调用的疑问求助

Python Version Management Confusion on Windows: Breakdown & Fixes

Let me walk you through what's happening here—Windows Python versioning can definitely feel chaotic at first!

First: What is CPython?

You mentioned you "never installed CPython"—that's a common misunderstanding! CPython is the standard, official implementation of Python (written in C, hence the name). Every version of Python you listed (3.11, 3.12, 3.14) is CPython. The uv venv command just explicitly labels it to distinguish it from other Python implementations like PyPy or Jython.

Let's Break Down Your Command Outputs

1. where python Results

The where command lists all python.exe files in your system's PATH environment variable:

  • C:\Users\SamuelPC\AppData\Local\Microsoft\WindowsApps\python.exe: This is the Microsoft Store version of Python 3.12.10. Windows often adds this to PATH automatically if you install Python via the Store.
  • C:\Users\SamuelPC\AppData\Local\Python\bin\python.exe: This is a manually installed Python 3.14.4 (likely from python.org). The order here means if you just run python in the terminal, it'll use the Store version first (since it's earlier in PATH).

2. py -0p Results

The py.exe tool is Windows' official Python Launcher—it scans your entire system for installed Python versions, not just those in PATH. That's why it shows an extra 3.11 version you didn't see with where python:

  • The * next to 3.14 means that's the launcher's default version.
  • The 3.11 version at C:\Users\SamuelPC\AppData\Local\Programs\Python\Python311\python.exe is probably an older installation you might have forgotten about (it doesn't show up in where python because its path isn't in your PATH variable).

3. Why uv venv Used CPython 3.13.0?

uv is a modern Python package manager that has a handy (but sometimes confusing) feature: if it can't find a specified Python version locally, it will automatically download and use the matching CPython version for your virtual environment.

You probably didn't explicitly tell uv which version to use, so it might have picked 3.13.0 based on:

  • A pyproject.toml file in your directory that specifies a Python version constraint (like >=3.13)
  • uv's default behavior for new projects (though usually it tries to use your system's default if possible)

How to Fix This & Take Control

Here are actionable steps to manage your Python versions:

  • Specify a version for uv venv: Use uv venv --python 3.14 (or --python 3.12, --python 3.11) to force uv to use the exact version you want. You can also use the full path to the executable, like uv venv --python C:\Users\SamuelPC\AppData\Local\Python\bin\python.exe.
  • Use the Python Launcher for version control: Instead of python, use py -3.14 to run 3.14, py -3.11 to run 3.11, etc. To create a virtual environment with a specific version, use py -3.11 -m venv .venv.
  • Clean up unused versions: Go to Windows Settings > Apps > Installed Apps, find the Python versions you don't need, and uninstall them. You can also delete the corresponding folders if they're leftover.
  • Adjust your PATH: If you want your manually installed 3.14 to be the default when you run python, move C:\Users\SamuelPC\AppData\Local\Python\bin to the top of your system PATH variable (search "Edit the system environment variables" to access this).

内容的提问来源于stack exchange,提问作者Samuel Gonzalez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 10:54:05