Fundamentals 5 min read

Four Quick Ways to Launch the Right Python REPL When Multiple Versions Are Installed

This tutorial walks through four practical methods to enter the correct Python interactive shell on Windows when both Python 2 and Python 3 are installed, covering PATH ordering, opening a prompt in the install folder, the py launcher shortcuts, and virtual environments.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
Four Quick Ways to Launch the Right Python REPL When Multiple Versions Are Installed

When a Windows machine has both Python 2 and Python 3 installed, typing python at the command line launches whichever version appears first in the system PATH. The author demonstrates that on their system Python 2 starts by default because its PATH entry precedes Python 3's. To make Python 3 the default, move its PATH entry above Python 2's.

Method 2 — Open a prompt directly in the installation folder. Navigate to the directory containing python.exe (e.g., the Python 3 install folder). Hold Shift and right-click an empty area, then choose "Open command window here" (or type cmd in the folder's address bar and press Enter). Running python now starts that specific version. The same steps work for Python 2.

Method 3 — Use the py launcher (recommended as fastest). Without any PATH changes, run py -2 to start Python 2 or py -3 to start Python 3. The launcher is installed with Python 3.3+ and automatically detects registered versions.

Method 4 — Virtual environments. The author references two earlier articles on creating default and version-specific virtual environments on Windows. Activating a venv isolates the interpreter and packages, letting you work with a chosen Python version cleanly.

The article concludes that Method 3 ( py -2 / py -3) is the most convenient because it requires no environment-variable edits and works immediately from any directory.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Pythoncommand lineWindowsvirtual environmentPATHREPLmultiple versionspy launcher
Python Crawling & Data Mining
Written by

Python Crawling & Data Mining

Life's short, I code in Python. This channel shares Python web crawling, data mining, analysis, processing, visualization, automated testing, DevOps, big data, AI, cloud computing, machine learning tools, resources, news, technical articles, tutorial videos and learning materials. Join us!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.