4 Quick Tricks to Switch Between Python 2 and Python 3 on Windows
This article explains four practical methods for Windows users to quickly launch the interactive interpreter of either Python 2 or Python 3, covering command‑line shortcuts, folder‑based command windows, the py launcher, and environment‑variable or virtual‑environment setups.
When you need both Python 2 and Python 3 on a Windows machine, switching between versions can be cumbersome. This guide presents four practical techniques to quickly launch the interactive interpreter of the desired Python version.
Direct command line entry : Open a command prompt and type python. By default it starts the version that appears first in the system PATH (often Python 2). Adjust the PATH order to make Python 3 the default.
Open command window from the installation folder : Navigate to the folder containing python.exe (e.g., the Python 3 installation directory) and use Shift + right‑click → “Open command window here” (or type cmd in the address bar). Then run python.
Use the py launcher : On Windows the py launcher lets you specify the version explicitly: py -2 starts Python 2, and py -3 starts Python 3. This method requires no PATH changes.
Create dedicated environment variables or virtual environments : By defining separate PATH entries or using virtual environments you can isolate each Python version and invoke the desired one directly.
These shortcuts simplify working with multiple Python installations, especially the third method, which is the most convenient.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
