Windows系统下同时安装配置Python2.7和Python3.7说明一下Python是一种计算机程序设计语言。是一种动态的、面向对象的脚本语言最初被设计用于编写自动化脚本(shell)随着版本的不断更新和语言新功能的添加越来越多被用于独立的、大型项目的开发。随着Python的大潮流越来越多的人开始了Python学习不得不说现代科学的高速发展电脑性能越来越高使得Python这类解释性编程语言得到各类程序猿的喜爱。本文则是Windows下Python2和Python3双版本的安装配置过程。准备工具在python官方网站上下载Python3和Python2直接在官网点击Downloads-Windows就有两类的最新版本下载Python3.7安装文件64位下载Python2.7安装文件64位python2.7为msi安装文件python3.7为exe安装文件注安装文件选择32位还是64位请根据电脑系统本身决定安装配置过程Python3.7可以看到Python3.7版本的有安装过程中自动添加环境变量的功能上图红框打上勾后选择Customize installation上图蓝框。点击蓝框后出现此界面全部打上勾安装过程中自动安装pip、py launcher和Python IDLE等。Next选择路径开始安装。由于要同时安装Python2和3于是我在D盘下新建一个Python文件夹并在此生成Python37和Python27文件夹分别存放Python2和3。Python2.7选择安装路径持续Next进行安装。安装完成后添加Python2.7的环境变量。打开系统属性-高级-环境变量-系统变量选择Path编辑可以看到Python3.7的环境变量是已经自动写入的只需写入Python2.7的环境变量。测试安装但是此时Python由于有2和3版本会发生冲突则需要重命名来区分。将Python27文件夹下的python.exe和pythonw.exe改名为python2.exe和pythonw2.exe。将Python37文件夹下的python.exe和pythonw.exe改名为python3.exe和pythonw3.exe。使用cmd命令行模式查看Python是否安装配置成功。Windows PowerShell 版权所有 (C) 2012 Microsoft Corporation。保留所有权利。 PS C:\Users\Administrator python2 Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. quit Use quit() or Ctrl-Z plus Return to exit ^Z PS C:\Users\Administrator python3 Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. exit Use exit() or Ctrl-Z plus Return to exit quit() PS C:\Users\Administrator可以看到命令python2命令则进入Python2.7编译模式python3命令则进入Python3.7编译模式。以上便是Python2.7和Python3.7的安装配置过程但这并没有结束Python中的pip命令是非常重要的因为之前Python的重命名使得pip命令会报错那我们分别在Python2和3下重新安装过pip即解决问题。Windows PowerShell 版权所有 (C) 2012 Microsoft Corporation。保留所有权利。 PS C:\Users\Administrator python2 -m pip install --upgrade pip --force-reinstall DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 wo nt be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting pip Using cached https://pypi.tuna.tsinghua.edu.cn/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e6 75a1/pip-19.2.3-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.2.3 Uninstalling pip-19.2.3: Successfully uninstalled pip-19.2.3 Successfully installed pip-19.2.3 PS C:\Users\Administrator python3 -m pip install --upgrade pip --force-reinstall Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting pip Using cached https://pypi.tuna.tsinghua.edu.cn/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e6 75a1/pip-19.2.3-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.0.3 Uninstalling pip-19.0.3: Successfully uninstalled pip-19.0.3 Successfully installed pip-19.2.3 PS C:\Users\Administrator PS C:\Users\Administrator pip2 -V pip 19.2.3 from d:\opensource\python\python27\lib\site-packages\pip (python 2.7) PS C:\Users\Administrator pip3 -V pip 19.2.3 from d:\opensource\python\python37\lib\site-packages\pip (python 3.7) PS C:\Users\Administrator最后检查是否成功。关于Python的编译器Python安装自带的IDLE是一个比较简单的编译器很适合新手做一些简单训练。当然要成为一个合格的程序猿则需要使用一个适合自己的编译器Python的编译器有很多诸如eclipse、PyScripter、Pycharm等等。各个编译器有自己的特别之处但都大同小异写代码最重要的还是代码写得好
Windows系统下同时安装配置Python3.7和Python2.7
Windows系统下同时安装配置Python2.7和Python3.7说明一下Python是一种计算机程序设计语言。是一种动态的、面向对象的脚本语言最初被设计用于编写自动化脚本(shell)随着版本的不断更新和语言新功能的添加越来越多被用于独立的、大型项目的开发。随着Python的大潮流越来越多的人开始了Python学习不得不说现代科学的高速发展电脑性能越来越高使得Python这类解释性编程语言得到各类程序猿的喜爱。本文则是Windows下Python2和Python3双版本的安装配置过程。准备工具在python官方网站上下载Python3和Python2直接在官网点击Downloads-Windows就有两类的最新版本下载Python3.7安装文件64位下载Python2.7安装文件64位python2.7为msi安装文件python3.7为exe安装文件注安装文件选择32位还是64位请根据电脑系统本身决定安装配置过程Python3.7可以看到Python3.7版本的有安装过程中自动添加环境变量的功能上图红框打上勾后选择Customize installation上图蓝框。点击蓝框后出现此界面全部打上勾安装过程中自动安装pip、py launcher和Python IDLE等。Next选择路径开始安装。由于要同时安装Python2和3于是我在D盘下新建一个Python文件夹并在此生成Python37和Python27文件夹分别存放Python2和3。Python2.7选择安装路径持续Next进行安装。安装完成后添加Python2.7的环境变量。打开系统属性-高级-环境变量-系统变量选择Path编辑可以看到Python3.7的环境变量是已经自动写入的只需写入Python2.7的环境变量。测试安装但是此时Python由于有2和3版本会发生冲突则需要重命名来区分。将Python27文件夹下的python.exe和pythonw.exe改名为python2.exe和pythonw2.exe。将Python37文件夹下的python.exe和pythonw.exe改名为python3.exe和pythonw3.exe。使用cmd命令行模式查看Python是否安装配置成功。Windows PowerShell 版权所有 (C) 2012 Microsoft Corporation。保留所有权利。 PS C:\Users\Administrator python2 Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. quit Use quit() or Ctrl-Z plus Return to exit ^Z PS C:\Users\Administrator python3 Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32 Type help, copyright, credits or license for more information. exit Use exit() or Ctrl-Z plus Return to exit quit() PS C:\Users\Administrator可以看到命令python2命令则进入Python2.7编译模式python3命令则进入Python3.7编译模式。以上便是Python2.7和Python3.7的安装配置过程但这并没有结束Python中的pip命令是非常重要的因为之前Python的重命名使得pip命令会报错那我们分别在Python2和3下重新安装过pip即解决问题。Windows PowerShell 版权所有 (C) 2012 Microsoft Corporation。保留所有权利。 PS C:\Users\Administrator python2 -m pip install --upgrade pip --force-reinstall DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 wo nt be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting pip Using cached https://pypi.tuna.tsinghua.edu.cn/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e6 75a1/pip-19.2.3-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.2.3 Uninstalling pip-19.2.3: Successfully uninstalled pip-19.2.3 Successfully installed pip-19.2.3 PS C:\Users\Administrator python3 -m pip install --upgrade pip --force-reinstall Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting pip Using cached https://pypi.tuna.tsinghua.edu.cn/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e6 75a1/pip-19.2.3-py2.py3-none-any.whl Installing collected packages: pip Found existing installation: pip 19.0.3 Uninstalling pip-19.0.3: Successfully uninstalled pip-19.0.3 Successfully installed pip-19.2.3 PS C:\Users\Administrator PS C:\Users\Administrator pip2 -V pip 19.2.3 from d:\opensource\python\python27\lib\site-packages\pip (python 2.7) PS C:\Users\Administrator pip3 -V pip 19.2.3 from d:\opensource\python\python37\lib\site-packages\pip (python 3.7) PS C:\Users\Administrator最后检查是否成功。关于Python的编译器Python安装自带的IDLE是一个比较简单的编译器很适合新手做一些简单训练。当然要成为一个合格的程序猿则需要使用一个适合自己的编译器Python的编译器有很多诸如eclipse、PyScripter、Pycharm等等。各个编译器有自己的特别之处但都大同小异写代码最重要的还是代码写得好