Fundamentals 4 min read

How to Switch Between Multiple Python Versions and Manage Pipenv Environments

This guide explains how to handle multiple Python installations, set environment variables, create separate pipenv virtual environments for each version, and troubleshoot common path issues such as the Windows Store Python hijacking, providing step‑by‑step commands and screenshots.

Python Crawling & Data Mining
Python Crawling & Data Mining
Python Crawling & Data Mining
How to Switch Between Multiple Python Versions and Manage Pipenv Environments

Introduction

Hello, I'm PiPi. A question about switching Python versions was raised in a group, and I share the solution here.

The environment was complex: three different Python installations each with its own path, and pip paths also differed.

Solution

Someone suggested setting environment variables to resolve the issue.

Creating virtual environments with pipenv for each version can be done as follows:

python3.9 -m pipenv
python3.10 -m pipenv
python3.11 -m pipenv

After setting the variables, the problem was solved. A detail to note: if all three Python versions have pip, the one that appears first in the PATH becomes the default.

Another common problem is that typing python in the console opens the Microsoft Store instead of the installed interpreter. This happens because the Store's Python path is earlier in the PATH variable. Removing that entry fixes the issue.

Conclusion

This article reviews basic Python environment issues, provides analysis and code, and helps readers resolve version and path conflicts.

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.

virtual environmentversion-managementpipenvEnvironment Variables
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.