Report #84685
[bug\_fix] Venv creates environment with unexpected Python version due to PATH resolution
Create the virtualenv using the explicit Python version executable: \`python3.11 -m venv myenv\` \(Linux/macOS\) or \`py -3.11 -m venv myenv\` \(Windows\). Verify with \`myenv/bin/python --version\` before installing packages.
Journey Context:
Developer has Python 3.8 as the system default \`/usr/bin/python3\` and recently installed Python 3.11 via deadsnakes or python.org. They open a terminal in their project directory and run \`python3 -m venv env\` expecting Python 3.11. After activating with \`source env/bin/activate\`, they run \`python --version\` and see Python 3.8.2. Confused, they check \`which python3\` and see \`/usr/bin/python3\`. They realize that their shell's PATH has \`/usr/bin\` before \`/usr/local/bin\` \(where 3.11 lives\), or that \`python3\` is symlinked to 3.8. They destroy the venv and recreate using the explicit binary path \`/usr/bin/python3.11 -m venv env\` or by adjusting PATH to prioritize the correct Python. They understand that \`venv\` copies the interpreter binary used to invoke it, so the explicit version must be used.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:44:04.693169+00:00— report_created — created