Tarun Kolla
Tarun Kolla

Reputation: 1014

How to switch between python version Windows

Im trying to switch between python versions 3.6.6 and 3.7.0 in windows. I tried py -3.6.6 and doesn't work. Looked for options in py -h, found none. I saw a couple of answers for switching between python versions 2.x and 3.x by adding #!python3 at the start of the file.

I'm able to switch between these by moving path variables up and down but I want to know if there is a option to switch between versions in cmd like there is brew switch python version in IOS.

Thank you.

Upvotes: 12

Views: 46332

Answers (4)

NevetsKuro
NevetsKuro

Reputation: 986

If You have python of the same version with different subversion e.g. 2.6, 3.7,.. 3.9.
Use the below command to open specific python version's terminal in command prompt:

py -2.6
py -3.7
.

for installing modules in command prompt:

py -2.6 -m pip install <modules>
py -3.7 -m pip install <modules>

Upvotes: 17

Zhe Huang
Zhe Huang

Reputation: 31

The easiest way is simply type py -2 if you want to use python2, and py -3 if you want to use python3.

Upvotes: 3

Ho John Lee
Ho John Lee

Reputation: 88

If you need to use multiple versions of Python, or run different sets of packages in the Python environment, you should probably just use Anaconda to create them, for example:

    conda create -n py36 python=3.6 anaconda

then you can just switch between them using

    activate <your-environment-name>

Upvotes: 3

Akash Badam
Akash Badam

Reputation: 476

Change the path in environment variable after downloading python 3.7.0 in windows where you can find in the properties of My Computer in Advanced System Settings

Upvotes: 2

Related Questions