1. nstall both Python 2.7 and 3.4 with the windows installers.
  2. Go to C:\Python34 (the default install path) and change python.exe to python3.exe
  3. Edit your environment variables to include C:\Python27\;C:\Python27\Scripts\;C:\Python34\;C:\Python34\Scripts\;

 

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

https://datascience.com.co/how-to-install-python-2-7-and-3-6-in-windows-10-add-python-path-281e7eae62a

1. Download python 2.7

Go to www.python.org/downloads and click on ‘Download Python 2.714”.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第1张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第2张

Wait until installation package is complete.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第3张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第4张

2. Install python 2.7

When download is finished click to install. You need to select a destination directory where python files and executables will be located. In my case I chose “C:\Python27” as my directory.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第5张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第6张

Wait until install is complete.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第7张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第8张

Click Finish

Can I install Python 3.x and 2.x on the same Windows computer? Python 第9张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第10张

3. Download python3

In the same way as described in step 1, download python3.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第11张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第12张

Click on executable to install and choose ‘Customize installation’.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第13张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第14张

Select default values and customize install location to C:\Python3

Can I install Python 3.x and 2.x on the same Windows computer? Python 第15张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第16张

4. Add python27 and python3 PATH

Search ‘Panel de control’ and open it.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第17张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第18张

In the search bar, search for ‘variable de entorno’.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第19张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第20张

Click on ‘Variables de entorno’

Can I install Python 3.x and 2.x on the same Windows computer? Python 第21张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第22张

Select PATH and click on ‘Nueva’

Can I install Python 3.x and 2.x on the same Windows computer? Python 第23张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第24张

Add the following routes in order to use python and pip.

C:\Python27

C:\Python27\Scripts

C:\Python3

C:\Python3\Scripts

Note: If you have installed python on a different location you need to find your where python is and set that location.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第25张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第26张

5. Change executables names

In order to execute both python version change the python.exe to python2.exe where python2 is located and python.exe to python3.exe where python3 is located.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第27张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第28张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第29张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第30张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第31张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第32张

Source: https://stackoverflow.com/questions/3809314/how-to-install-both-python-2-x-and-python-3-x-in-windows-7

6. TEST Both Python versions

a. Check python versions

Run Python2 –V and Python3 –V to get respective python versions.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第33张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第34张

b. Install a package using python2 and python3

If the above commands run without problems python2 and python3 were successfully installed on windows 10 environment.

Can I install Python 3.x and 2.x on the same Windows computer? Python 第35张 Can I install Python 3.x and 2.x on the same Windows computer? Python 第36张

Jose Miguel Arrieta

January 2018

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄