首页 > 解决方案 > 创建符合旧版 Anaconda 的 conda 虚拟环境

问题描述

我正在尝试找到一种方法来安装 Anaconda 的第二个版本(以及所有相关的软件包),或者创建一个完全符合旧版本 Anaconda(特别是 Anaconda 4.2 / python 3.5)的虚拟环境。

背景:虽然我个人正在开发 Anaconda (2021.05) 的相对最新版本,但我正在为一家仍在使用 Anaconda 4.2 的公司举办研讨会。为了简化研讨会的创建,我想在 jupyter notebook 中使用 Anaconda 4.2 的确切基础环境编写一些示例代码。但是,我似乎无法在不运行各种兼容性问题的情况下设置这样的虚拟环境。我觉得必须有一种更简单的方法,而不是每次切换项目时重新安装 Anaconda,或者联合使用 conda 和 pip 以正确版本将一堆相关软件包组合在一起(目前总是导致兼容性问题)。要求公司迁移到更新版本并不是一个真正的选择。

更多细节:我的主要问题源于 anaconda 的默认通道中缺少旧版本的 pandas、numpy、matplotlib 和 scikit learn,迫使我使用 pip 安装这些版本,从而导致兼容性问题。

标签: pythonanacondaconda

解决方案


对于 anaconda 5.0,recipes/compilers 发生了变化,并且在该变化之前可用的所有包现在都在free通道中,这不是提高conda.

由于您想要一个相当旧的 anaconda 版本,因此您需要添加它。为了获得所有附带的包anaconda-4.2.0,您可以简单地使用anaconda元包。即创建一个对应于anaconda 4.2的环境,只需执行以下操作:

conda create -c free -n anaconda42 anaconda=4.2.0

正确安装这些软件包:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _license-1.1               |           py35_1          56 KB  free
    _nb_ext_conf-0.3.0         |           py35_0          929 B  free
    alabaster-0.7.9            |           py35_0          11 KB  free
    anaconda-4.2.0             |      np111py35_0          16 KB  free
    anaconda-clean-1.0.0       |           py35_0          42 KB  free
    anaconda-client-1.5.1      |           py35_0         166 KB  free
    anaconda-navigator-1.3.1   |           py35_0         3.1 MB  free
    argcomplete-1.0.0          |           py35_1          84 KB  free
    astroid-1.4.7              |           py35_0         258 KB  free
    astropy-1.2.1              |      np111py35_0         6.1 MB  free
    babel-2.3.4                |           py35_0         4.8 MB  free
    backports-1.0              |           py35_0           1 KB  free
    beautifulsoup4-4.5.1       |           py35_0         125 KB  free
    bitarray-0.8.1             |           py35_1          57 KB  free
    blas-1.0                   |              mkl           6 KB  free
    blaze-0.10.1               |           py35_0         622 KB  free
    bokeh-0.12.2               |           py35_0         3.4 MB  free
    boto-2.42.0                |           py35_0         1.5 MB  free
    bottleneck-1.1.0           |      np111py35_0         191 KB  free
    cffi-1.7.0                 |           py35_0         130 KB  free
    chest-0.2.3                |           py35_0           5 KB  free
    click-6.6                  |           py35_0         100 KB  free
    cloudpickle-0.2.1          |           py35_0          17 KB  free
    clyent-1.2.2               |           py35_0          15 KB  free
    colorama-0.3.7             |           py35_0          19 KB  free
    comtypes-1.1.2             |           py35_0         220 KB  free
    configobj-5.0.6            |           py35_0          28 KB  free
    console_shortcut-0.1.1     |           py35_1          47 KB  free
    contextlib2-0.5.3          |           py35_0          12 KB  free
    cryptography-1.5           |           py35_0         331 KB  free
    curl-7.49.0                |           vc14_0         305 KB  free
    cython-0.24.1              |           py35_0         2.2 MB  free
    cytoolz-0.8.0              |           py35_0         243 KB  free
    dask-0.11.0                |           py35_0         624 KB  free
    datashape-0.5.2            |           py35_0          94 KB  free
    decorator-4.0.10           |           py35_0          12 KB  free
    dill-0.2.5                 |           py35_0          75 KB  free
    docutils-0.12              |           py35_2         674 KB  free
    dynd-python-0.7.2          |           py35_0         435 KB  free
    entrypoints-0.2.2          |           py35_0           6 KB  free
    et_xmlfile-1.0.1           |           py35_0          15 KB  free
    fastcache-1.0.2            |           py35_1          27 KB  free
    filelock-2.0.6             |           py35_0           8 KB  free
    flask-0.11.1               |           py35_0         139 KB  free
    flask-cors-2.1.2           |           py35_0          16 KB  free
    freetype-2.5.5             |           vc14_1         621 KB  free
    get_terminal_size-1.0.0    |           py35_0           4 KB  free
    gevent-1.1.2               |           py35_0         471 KB  free
    greenlet-0.4.10            |           py35_0          16 KB  free
    h5py-2.6.0                 |      np111py35_2         656 KB  free
    hdf5-1.8.15.1              |           vc14_4         1.5 MB  free
    heapdict-1.0.0             |           py35_1           5 KB  free
    icu-57.1                   |           vc14_0        34.2 MB  free
    idna-2.1                   |           py35_0         115 KB  free
    imagesize-0.7.1            |           py35_0           3 KB  free
    ipykernel-4.5.0            |           py35_0         126 KB  free
    ipython-5.1.0              |           py35_0         1.0 MB  free
    ipython_genutils-0.1.0     |           py35_0          33 KB  free
    ipywidgets-5.2.2           |           py35_0          59 KB  free
    itsdangerous-0.24          |           py35_0           8 KB  free
    jdcal-1.2                  |           py35_1           9 KB  free
    jedi-0.9.0                 |           py35_1         195 KB  free
    jinja2-2.8                 |           py35_1         300 KB  free
    jsonschema-2.5.1           |           py35_0          97 KB  free
    jupyter-1.0.0              |           py35_3           3 KB  free
    jupyter_client-4.4.0       |           py35_0         141 KB  free
    jupyter_console-5.0.0      |           py35_0          69 KB  free
    jupyter_core-4.2.0         |           py35_0         104 KB  free
    lazy-object-proxy-1.2.1    |           py35_0          27 KB  free
    libdynd-0.7.2              |                0         3.9 MB  free
    libpng-1.6.22              |           vc14_0         547 KB  free
    llvmlite-0.13.0            |           py35_0         6.2 MB  free
    locket-0.2.0               |           py35_1           6 KB  free
    lxml-3.6.4                 |           py35_0         1.6 MB  free
    markupsafe-0.23            |           py35_2          28 KB  free
    matplotlib-1.5.3           |      np111py35_0         6.2 MB  free
    menuinst-1.4.1             |           py35_0         107 KB  free
    mistune-0.7.3              |           py35_0         131 KB  free
    mkl-11.3.3                 |                1       110.0 MB  free
    mkl-service-1.1.2          |           py35_2          10 KB  free
    mpmath-0.19                |           py35_1         897 KB  free
    multipledispatch-0.4.8     |           py35_0          12 KB  free
    nb_anacondacloud-1.2.0     |           py35_0          23 KB  free
    nb_conda-2.0.0             |           py35_0          28 KB  free
    nb_conda_kernels-2.0.0     |           py35_0          30 KB  free
    nbconvert-4.2.0            |           py35_0         358 KB  free
    nbformat-4.1.0             |           py35_0         159 KB  free
    nbpresent-3.0.2            |           py35_0         502 KB  free
    networkx-1.11              |           py35_0         1.1 MB  free
    nltk-3.2.1                 |           py35_0         1.8 MB  free
    notebook-4.2.3             |           py35_0         5.2 MB  free
    numba-0.28.1               |      np111py35_0         1.9 MB  free
    numexpr-2.6.1              |      np111py35_0         142 KB  free
    numpy-1.11.1               |           py35_1         2.8 MB  free
    odo-0.5.0                  |           py35_1         219 KB  free
    openpyxl-2.3.2             |           py35_0         253 KB  free
    openssl-1.0.2j             |           vc14_0         5.1 MB  free
    pandas-0.18.1              |      np111py35_0         6.9 MB  free
    partd-0.3.6                |           py35_0          25 KB  free
    path.py-8.2.1              |           py35_0          47 KB  free
    pathlib2-2.1.0             |           py35_0          28 KB  free
    patsy-0.4.1                |           py35_0         370 KB  free
    pep8-1.7.0                 |           py35_0          67 KB  free
    pickleshare-0.7.4          |           py35_0           9 KB  free
    pillow-3.3.1               |           py35_0         983 KB  free
    pip-8.1.2                  |           py35_0         1.6 MB  free
    pkginfo-1.3.2              |           py35_0          73 KB  free
    ply-3.9                    |           py35_0          72 KB  free
    prompt_toolkit-1.0.3       |           py35_0         308 KB  free
    psutil-4.3.1               |           py35_0         228 KB  free
    py-1.4.31                  |           py35_0         127 KB  free
    pyasn1-0.1.9               |           py35_0          57 KB  free
    pycosat-0.6.1              |           py35_1          80 KB  free
    pycparser-2.14             |           py35_1         152 KB  free
    pycrypto-2.6.1             |           py35_4         481 KB  free
    pycurl-7.43.0              |           py35_0          89 KB  free
    pyflakes-1.3.0             |           py35_0         119 KB  free
    pygments-2.1.3             |           py35_0         1.3 MB  free
    pylint-1.5.4               |           py35_1         347 KB  free
    pyopenssl-16.0.0           |           py35_0          68 KB  free
    pyparsing-2.1.4            |           py35_0          72 KB  free
    pyqt-5.6.0                 |           py35_0         4.4 MB  free
    pytables-3.2.2             |      np111py35_4         1.5 MB  free
    pytest-2.9.2               |           py35_0         282 KB  free
    python-3.5.2               |                0        30.3 MB  free
    python-dateutil-2.5.3      |           py35_0         237 KB  free
    pytz-2016.6.1              |           py35_0         171 KB  free
    pywin32-220                |           py35_1        10.4 MB  free
    pyyaml-3.12                |           py35_0         118 KB  free
    pyzmq-15.4.0               |           py35_0         498 KB  free
    qt-5.6.0                   |           vc14_0        51.2 MB  free
    qtawesome-0.3.3            |           py35_0         153 KB  free
    qtconsole-4.2.1            |           py35_2         201 KB  free
    qtpy-1.1.2                 |           py35_0          22 KB  free
    requests-2.11.1            |           py35_0         665 KB  free
    rope-0.9.4                 |           py35_1         237 KB  free
    scikit-image-0.12.3        |      np111py35_1        17.6 MB  free
    scikit-learn-0.17.1        |      np111py35_1         3.5 MB  free
    scipy-0.18.1               |      np111py35_0        11.7 MB  free
    setuptools-27.2.0          |           py35_1         761 KB  free
    simplegeneric-0.8.1        |           py35_1           7 KB  free
    singledispatch-3.4.0.3     |           py35_0          13 KB  free
    six-1.10.0                 |           py35_0           8 KB  free
    snowballstemmer-1.2.1      |           py35_0          79 KB  free
    sockjs-tornado-1.0.3       |           py35_0          33 KB  free
    sphinx-1.4.6               |           py35_0         1.3 MB  free
    spyder-3.0.0               |           py35_0         2.9 MB  free
    sqlalchemy-1.0.13          |           py35_0         1.4 MB  free
    statsmodels-0.6.1          |      np111py35_1         4.7 MB  free
    sympy-1.0                  |           py35_0         6.4 MB  free
    toolz-0.8.0                |           py35_0          80 KB  free
    tornado-4.4.1              |           py35_0         595 KB  free
    traitlets-4.3.0            |           py35_0         124 KB  free
    unicodecsv-0.14.1          |           py35_0          20 KB  free
    vs2015_runtime-14.0.25123  |                0         1.9 MB  free
    wcwidth-0.1.7              |           py35_0          21 KB  free
    werkzeug-0.11.11           |           py35_0         335 KB  free
    widgetsnbextension-1.2.6   |           py35_0         1.1 MB  free
    win_unicode_console-0.5    |           py35_0          27 KB  free
    wrapt-1.10.6               |           py35_0          38 KB  free
    xlrd-1.0.0                 |           py35_0         182 KB  free
    xlsxwriter-0.9.3           |           py35_0         192 KB  free
    xlwings-0.10.0             |           py35_0         741 KB  free
    xlwt-1.1.2                 |           py35_0         157 KB  free
    zlib-1.2.8                 |           vc14_3         111 KB  free
    ------------------------------------------------------------
                                           Total:       385.1 MB

推荐阅读