Mosa Abbas
Mosa Abbas

Reputation: 149

how can i run two versions of python 2.7.15 and 3.6.4 and How to install packages to specific version of python?

I'm using python 3.6.4 and 2.5.17 windows 10 and when I try to run any code, it only runs using version 2.7.15 I've tried to add to the first line of my code:

#! python3

or

#! python2

and nothing happened and I also tried to use

py -the number of versions

i have this output:

'py' is not recognized as an internal or external command, operable program or batch file.

and if I wanna download anything using pip or pip3 command for python 3.6.4 it only installs it for python 2.7.15. I've checked the environment variables I have python 2.7.15 and 3.6.4 included Can anyone one help me?

edit:

i have the py launcher installed on my PC :

see here

and when i try to run it :

see here

and python files are included in the system variables

see here

and the python 3.6.4 directory only contain thous files :

see here

so what i have to do to run two versins of python now ?? and how to run scripts in atom ?

Upvotes: 1

Views: 731

Answers (1)

CodeHunter
CodeHunter

Reputation: 2082

Not sure about windows, but if you have installed Anaconda prompt for windows, then you can install different versions of python on Anaconda prompt and give them specific names. Like for me, I have python3.6.5 version named as base version and the python2.7 version as py27. Whenever I need to switch to either of them, I just use activate command:

activate py27 //to switch to python2.7

activate base    //to switch to python3.6.5

This automatically switches me to specified version of python in the anaconda prompt and then you can work it whichever way you like.

Upvotes: 3

Related Questions