在Conda的这个guide中,他们解释了如何通过创建不同的环境在Anaconda中设置不同版本的Python。所以我继续创建3个环境:Python 3.4 Python 3.5和Python 3.6。 我设置了最后一个版本的Conda 4.4.10 (2018-02-09)
$conda create -n py36 python=3.6 anaconda --offline
Solving environment: done
Package Plan
environment location: /opt/Anaconda/Anaconda3-5.1.0/envs/py36
added / updated specs:
- anaconda
- python=3.6
The following NEW packages will be INSTALLED:
alabaster: 0.7.10-py36h306e16b_0
anaconda: 5.1.0-py36_2
.................OTHERs PKGS.......................
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use:
# > source activate py36
#
# To deactivate an active environment, use:
# > source deactivate
在这里我们可以看到我成功地创建了一个py36环境:
$conda env list
# conda environments:
#
base * /opt/Anaconda/Anaconda3-5.1.0
py36 /opt/Anaconda/Anaconda3-5.1.0/envs/py36
$conda create -n py35 python=3.5 anaconda --offline
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.5
Current channels:
- https://repo.continuum.io/pkgs/main/linux-64
- https://repo.continuum.io/pkgs/main/noarch
- https://repo.continuum.io/pkgs/free/linux-64
- https://repo.continuum.io/pkgs/free/noarch
- https://repo.continuum.io/pkgs/r/linux-64
- https://repo.continuum.io/pkgs/r/noarch
- https://repo.continuum.io/pkgs/pro/linux-64
- https://repo.continuum.io/pkgs/pro/noarch
当我查看我的Python版本时,我得到:
$conda search python --offline
Loading channels: done
Name Version Build Channel
python 3.3.0 3 defaults
python 3.3.0 4 defaults
python 3.3.0 pro0 defaults
python 3.3.0 pro1 defaults
python 3.3.1 0 defaults
python 3.3.2 0 defaults
python 3.3.2 1 defaults
.....................ALL Versions between...................
python 3.6.3 h6c0c0dc_5 defaults
python 3.6.3 hc9025b9_1 defaults
python 3.6.3 hcad60d5_0 defaults
python 3.6.3 hefd0734_2 defaults
python 3.6.4 hc3d631a_0 defaults
python 3.6.4 hc3d631a_1 defaults