推荐:使用 Anaconda 工具搭建并管理 Python 环境

https://www.anaconda.com/distribution/#download-section  官网下载地址

https://www.anaconda.com/products/individual    下载地址在页面底部区域

https://mirror.tuna.tsinghua.edu.cn/help/anaconda/     Anaconda 镜像使用帮助

https://repo.anaconda.com/archive/Anaconda2-2019.07-Windows-x86_64.exe  64bit  for Python 2.7 version,使用IDM下载即可

https://repo.anaconda.com/archive/Anaconda3-2019.07-Windows-x86_64.exe   64bit  for  Python 3.7 version ,使用IDM下载即可

Anaconda3 没有开始菜单,参考:https://www.jianshu.com/p/beb59ca2b46e   ?


 一、安装 Anaconda2-2019.07-Windows-x86_64.exe

 

 开始菜单

安装完成。已经自动安装了python 2.7.16

可以将 “D:PythonWorkAnaconda2” 目录添加到path中

二、再安装 python 3.7

开始菜单 --> 启动 Anaconda Prompt (Anaconda2)

运行命令:conda create -n python37 python=3.7

安装过程:

(base) C:Userszh>conda create -n python37 python=3.7
Collecting package metadata (current_repodata.json): done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.7.10
  latest version: 4.7.11

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: D:PythonWorkAnaconda2envspython37

  added / updated specs:
    - python=3.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2019.5.15  |                1         127 KB
    certifi-2019.6.16          |           py37_1         152 KB
    openssl-1.1.1d             |       he774522_0         5.7 MB
    pip-19.2.2                 |           py37_0         1.7 MB
    python-3.7.4               |       h5263a28_0        14.7 MB
    setuptools-41.0.1          |           py37_0         520 KB
    sqlite-3.29.0              |       he774522_0         624 KB
    vc-14.1                    |       h0510ff6_4           6 KB
    vs2015_runtime-14.16.27012 |       hf0eaf9b_0         1.1 MB
    wheel-0.33.4               |           py37_0          57 KB
    wincertstore-0.2           |           py37_0          14 KB
    ------------------------------------------------------------
                                           Total:        24.7 MB

The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/win-64::ca-certificates-2019.5.15-1
  certifi            pkgs/main/win-64::certifi-2019.6.16-py37_1
  openssl            pkgs/main/win-64::openssl-1.1.1d-he774522_0
  pip                pkgs/main/win-64::pip-19.2.2-py37_0
  python             pkgs/main/win-64::python-3.7.4-h5263a28_0
  setuptools         pkgs/main/win-64::setuptools-41.0.1-py37_0
  sqlite             pkgs/main/win-64::sqlite-3.29.0-he774522_0
  vc                 pkgs/main/win-64::vc-14.1-h0510ff6_4
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.16.27012-hf0eaf9b_0
  wheel              pkgs/main/win-64::wheel-0.33.4-py37_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py37_0


Proceed ([y]/n)? y


Downloading and Extracting Packages
vc-14.1              | 6 KB      | #################################### | 100%
wincertstore-0.2     | 14 KB     | #################################### | 100%
pip-19.2.2           | 1.7 MB    | #################################### | 100%
vs2015_runtime-14.16 | 1.1 MB    | #################################### | 100%
openssl-1.1.1d       | 5.7 MB    | #################################### | 100%
setuptools-41.0.1    | 520 KB    | #################################### | 100%
certifi-2019.6.16    | 152 KB    | #################################### | 100%
ca-certificates-2019 | 127 KB    | #################################### | 100%
wheel-0.33.4         | 57 KB     | #################################### | 100%
sqlite-3.29.0        | 624 KB    | #################################### | 100%
python-3.7.4         | 14.7 MB   | #################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate python37
#
# To deactivate an active environment, use
#
#     $ conda deactivate


(base) C:Userszh>

切到python 3.7 命令:conda activate python37

回到python 2.7 命令:conda deactivate

三、打开 python IDE工具

开始菜单 ---启动---> Spyder (Anaconda2)

主界面,默认使用的是 Python 2.7:

如何让 Spyder 使用Python 3.7 ?

方法步骤:

开始菜单 --> 启动 Anaconda Prompt (Anaconda2) ,然后依次运行如下命令:

1. 切到python 3.7 命令:conda activate python37

2. 安装spyder命令: conda install spyder

3. 命令行启动:spyder

当然,开始菜单也可以启动 ---> Spyder (python37)

经过上述步骤后,若想使用python 2.7,则启动“Spyder (Anaconda2)” ;若想使用python 3.x,则启动“Spyder (python37)” 即可,完美!

备注:

安装第三方包:

方法1: conda install xlwt  (以安装xlwt 为例)

方法2:采用Anaconda Navigator来安装(开始菜单---启动),简单方便

注意:

如果为python 3.7 安装 第三方包(xlwt),则需要先切到 python37,然后再执行安装

参考:

https://www.cnblogs.com/liruihuan/p/9101613.html   Anaconda 安装和使用

https://blog.csdn.net/wz947324/article/details/80228679   Anaconda不同版本python环境的安装及切换

https://blog.csdn.net/qq_38188725/article/details/80624004  python神器——Anaconda的安装与优化配置

附:

https://www.spyder-ide.org/   python 开发工具

原文地址:https://www.cnblogs.com/onelikeone/p/11521462.html