资料: https://mirrors.bfsu.edu.cn/help/anaconda/
参考: https://www.jianshu.com/p/edaa744ea47d
conda 简介
Conda 是一个开源的软件包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖关系,并在它们之间轻松切换。 Conda 是为 Python 程序创建的,适用于 Linux,OS X 和Windows,也可以打包和分发其他软件。
Anaconda 与 miniconda,前者包括较多的人工智能、数据分析、深度学习的包,都有 conda,用于包管理,环境管理。
本次使用的是 miniconda
下载地址: https://docs.conda.io/en/latest/miniconda.html
根据提示安装即可
配置镜像
都说清华镜像好,那就清华的吧
conda config —add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config —add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config —add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config —add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
# 查看版本PS D:\devTools\Python\virtual_env> conda --versionconda 4.11.0PS D:\devTools\Python\virtual_env>PS D:\devTools\Python\virtual_env># 添加清华镜像PS D:\devTools\Python\virtual_env> conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/PS D:\devTools\Python\virtual_env> conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/PS D:\devTools\Python\virtual_env> conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/PS D:\devTools\Python\virtual_env> conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/PS D:\devTools\Python\virtual_env>
查看镜像
conda config —set show_channel_urls yes
conda config —get channels
PS D:\devTools\Python\virtual_env> conda config --set show_channel_urls yesPS D:\devTools\Python\virtual_env>PS D:\devTools\Python\virtual_env> conda config --get channels--add channels 'defaults' # lowest priority--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/'--add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/' # highest priorityPS D:\devTools\Python\virtual_env>PS D:\devTools\Python\virtual_env>
conda 的 help
conda —help
PS D:\devTools\Python\virtual_env> conda --helpusage: conda-script.py [-h] [-V] command ...conda is a tool for managing and deploying applications, environments and packages.Options:positional arguments:commandclean Remove unused packages and caches.compare Compare packages between conda environments.config Modify configuration values in .condarc. This is modeled after the git config command. Writes to the user .condarc file(C:\Users\DELL\.condarc) by default.create Create a new conda environment from a list of specified packages.help Displays a list of available conda commands and their help strings.info Display information about current conda install.init Initialize conda for shell interaction. [Experimental]install Installs a list of packages into a specified conda environment.list List linked packages in a conda environment.package Low-level conda package utility. (EXPERIMENTAL)remove Remove a list of packages from a specified conda environment.uninstall Alias for conda remove.run Run an executable in a conda environment. [Experimental]search Search for packages and display associated information. The input is a MatchSpec, a query language for conda packages. Seeexamples below.update Updates conda packages to the latest compatible version.upgrade Alias for conda update.optional arguments:-h, --help Show this help message and exit.-V, --version Show the conda version number and exit.conda commands available from other packages:content-trustenvPS D:\devTools\Python\virtual_env>
环境管理
conda env list 查看安装的环境
conda env list
PS D:\devTools\Python\virtual_env> conda env list# conda environments:#base * D:\devTools\Python\Miniconda3PS D:\devTools\Python\virtual_env>
新环境只有一个 base 的 env,建议不要删除。
conda create -n env_name python=python_version 创建env
conda create -n python36 python=3.6 会默认安装 python3.6 当期最新版本
PS D:\devTools\Python\virtual_env> conda create -n python36 python=3.6Collecting package metadata (current_repodata.json): doneSolving environment: done## Package Plan ##environment location: D:\devTools\Python\Miniconda3\envs\python36added / updated specs:- python=3.6The following packages will be downloaded:package | build---------------------------|-----------------certifi-2020.6.20 | pyhd3eb1b0_3 155 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mainpip-20.0.2 | py36_1 1.9 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython-3.6.15 |h39d44d4_0_cpython 18.9 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython_abi-3.6 | 2_cp36m 4 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesetuptools-49.6.0 | py36ha15d459_3 921 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeucrt-10.0.20348.0 | h57928b3_0 1.2 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgevc-14.2 | hb210afc_6 13 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgevs2015_runtime-14.29.30037 | h902a5da_6 1.3 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewheel-0.37.1 | pyhd8ed1ab_0 31 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewincertstore-0.2 |py36ha15d459_1006 15 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge------------------------------------------------------------Total: 24.4 MBThe following NEW packages will be INSTALLED:done## To activate this environment, use## $ conda activate python36## To deactivate an active environment, use## $ conda deactivatePS D:\devTools\Python\virtual_env>
当然,安装python环境的时候可以同时指定需要的包,比如 Django、flask、Djangorestframework 等,比如:
conda create -n python27 python=2.7 django djangorestframework
PS D:\devTools\Python\virtual_env> conda create -n python27 python=2.7 django djangorestframeworkCollecting package metadata (current_repodata.json): doneSolving environment: done## Package Plan ##environment location: D:\devTools\Python\Miniconda3\envs\python27added / updated specs:- django- djangorestframework- python=2.7The following packages will be downloaded:package | build---------------------------|-----------------django-1.11.25 | py27h85ba907_0 4.3 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgedjangorestframework-3.6.3 | py27_0 964 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepip-20.0.2 | py27_1 1.9 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython-2.7.15 |h2880e7c_1011_cpython 20.3 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython_abi-2.7 | 1_cp27m 4 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepytz-2019.3 | py_0 237 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesetuptools-36.4.0 | py27_1 525 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freevc-9 | h2eaa2aa_6 5 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mainvs2008_runtime-9.0.30729.6161| 0 1.0 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewincertstore-0.2 | py27_1003 13 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge------------------------------------------------------------Total: 29.3 MBThe following NEW packages will be INSTALLED:certifi anaconda/pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3done## To activate this environment, use## $ conda activate python27## To deactivate an active environment, use## $ conda deactivatePS D:\devTools\Python\virtual_env>
conda activate env_name 激活环境
conda activate python27
C:\Users\DELL>echo %OS%Windows_NTC:\Users\DELL>conda env list# conda environments:#base * D:\devTools\Python\Miniconda3python27 D:\devTools\Python\Miniconda3\envs\python27python36 D:\devTools\Python\Miniconda3\envs\python36C:\Users\DELL>conda activate python27(python27) C:\Users\DELL>
注意: 我的 Windows power shell 无法执行成功,要换 cmd 执行;
激活之后,前面会显示env名称,此次激活的就是 Python27,显示在了前面。
现在就可以像原来安装的对应版本进行使用 python 了。
简单使用(像本地的python一样,pip管理包)
(python27) C:\Users\DELL>python -VPython 2.7.15(python27) C:\Users\DELL>pip --versionpip 20.0.2 from D:\devTools\Python\Miniconda3\envs\python27\lib\site-packages\pip (python 2.7)(python27) C:\Users\DELL>(python27) C:\Users\DELL>pip listDEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. 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-supportPackage Version------------------- ---------certifi 2020.6.20Django 1.11.25djangorestframework 3.6.3pip 20.0.2pytz 2019.3setuptools 36.4.0wheel 0.37.1wincertstore 0.2(python27) C:\Users\DELL>
使用 conda 进行包管理
(python27) C:\Users\DELL>conda list # 查看已安装的包# packages in environment at D:\devTools\Python\Miniconda3\envs\python27:## Name Version Build Channelcertifi 2020.6.20 pyhd3eb1b0_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/maindjango 1.11.25 py27h85ba907_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgedjangorestframework 3.6.3 py27_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepip 20.0.2 py27_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython 2.7.15 h2880e7c_1011_cpython https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython_abi 2.7 1_cp27m https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepytz 2019.3 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesetuptools 36.4.0 py27_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freevc 9 h2eaa2aa_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mainvs2008_runtime 9.0.30729.6161 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewheel 0.37.1 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewincertstore 0.2 py27_1003 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge(python27) C:\Users\DELL>(python27) C:\Users\DELL>conda install drf_yasg # 安装 drf_yasgCollecting package metadata (current_repodata.json): doneSolving environment: failed with initial frozen solve. Retrying with flexible solve.Collecting package metadata (repodata.json): doneSolving environment: failed with initial frozen solve. Retrying with flexible solve.PackagesNotFoundError: The following packages are not available from current channels:- drf_yasgCurrent channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch- https://repo.anaconda.com/pkgs/main/win-64- https://repo.anaconda.com/pkgs/main/noarch- https://repo.anaconda.com/pkgs/r/win-64- https://repo.anaconda.com/pkgs/r/noarch- https://repo.anaconda.com/pkgs/msys2/win-64- https://repo.anaconda.com/pkgs/msys2/noarchTo search for alternate channels that may provide the conda package you'relooking for, navigate tohttps://anaconda.organd use the search bar at the top of the page.(python27) C:\Users\DELL>C:\Users\DELL>conda search drf_yasgLoading channels: doneNo match found for: drf_yasg. Search: *drf_yasg*PackagesNotFoundError: The following packages are not available from current channels:- drf_yasgCurrent channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch- https://repo.anaconda.com/pkgs/main/win-64- https://repo.anaconda.com/pkgs/main/noarch- https://repo.anaconda.com/pkgs/r/win-64- https://repo.anaconda.com/pkgs/r/noarch- https://repo.anaconda.com/pkgs/msys2/win-64- https://repo.anaconda.com/pkgs/msys2/noarchTo search for alternate channels that may provide the conda package you'relooking for, navigate tohttps://anaconda.organd use the search bar at the top of the page.C:\Users\DELL>conda search drf-yasgLoading channels: done# Name Version Build Channeldrf-yasg 1.17.1 py_0 anaconda/cloud/conda-forgedrf-yasg 1.20.0 py_0 anaconda/cloud/conda-forgeC:\Users\DELL>conda activate python27(python27) C:\Users\DELL>conda install drf-yasgCollecting package metadata (current_repodata.json): doneSolving environment: failed with initial frozen solve. Retrying with flexible solve.Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.Collecting package metadata (repodata.json): doneSolving environment: done## Package Plan ##environment location: D:\devTools\Python\Miniconda3\envs\python27added / updated specs:- drf-yasgThe following packages will be downloaded:package | build---------------------------|-----------------certifi-2019.11.28 | py27h8c360ce_1 149 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgecoreapi-2.3.3 | pyh9f0ad1d_0 23 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgecoreschema-0.0.4 | pyh9f0ad1d_0 15 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgedjangorestframework-3.9.4 | py_0 756 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgedrf-yasg-1.20.0 | py_0 1.3 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeinflection-0.5.1 | pyh9f0ad1d_0 9 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeitypes-1.2.0 | pyh9f0ad1d_0 7 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgejinja2-2.11.3 | pyh44b312d_0 93 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgemarkupsafe-1.1.1 | py27h462b5f4_1 26 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepackaging-20.9 | pyh44b312d_0 35 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepyparsing-2.4.7 | pyh9f0ad1d_0 60 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgerequests-2.13.0 | py27_0 780 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeruamel-1.0 | py27h8c360ce_2 4 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeruamel.ordereddict-0.4.14 | py27h0c8e037_0 35 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeruamel.yaml-0.16.6 | py27h462b5f4_1 165 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeruamel.yaml.clib-0.2.0 | py27h462b5f4_1 115 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesimplejson-3.17.0 | py27h462b5f4_1 100 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesix-1.16.0 | pyh6c4a22f_0 14 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeuritemplate-3.0.1 | py_0 16 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge------------------------------------------------------------Total: 3.6 MBThe following NEW packages will be INSTALLED:coreapi anaconda/cloud/conda-forge/noarch::coreapi-2.3.3-pyh9f0ad1d_0coreschema anaconda/cloud/conda-forge/noarch::coreschema-0.0.4-pyh9f0ad1d_0drf-yasg anaconda/cloud/conda-forge/noarch::drf-yasg-1.20.0-py_0inflection anaconda/cloud/conda-forge/noarch::inflection-0.5.1-pyh9f0ad1d_0itypes anaconda/cloud/conda-forge/noarch::itypes-1.2.0-pyh9f0ad1d_0jinja2 anaconda/cloud/conda-forge/noarch::jinja2-2.11.3-pyh44b312d_0markupsafe anaconda/cloud/conda-forge/win-64::markupsafe-1.1.1-py27h462b5f4_1packaging anaconda/cloud/conda-forge/noarch::packaging-20.9-pyh44b312d_0pyparsing anaconda/cloud/conda-forge/noarch::pyparsing-2.4.7-pyh9f0ad1d_0requests anaconda/cloud/conda-forge/win-64::requests-2.13.0-py27_0ruamel anaconda/cloud/conda-forge/win-64::ruamel-1.0-py27h8c360ce_2ruamel.ordereddict anaconda/cloud/conda-forge/win-64::ruamel.ordereddict-0.4.14-py27h0c8e037_0ruamel.yaml anaconda/cloud/conda-forge/win-64::ruamel.yaml-0.16.6-py27h462b5f4_1ruamel.yaml.clib anaconda/cloud/conda-forge/win-64::ruamel.yaml.clib-0.2.0-py27h462b5f4_1simplejson anaconda/cloud/conda-forge/win-64::simplejson-3.17.0-py27h462b5f4_1six anaconda/cloud/conda-forge/noarch::six-1.16.0-pyh6c4a22f_0uritemplate anaconda/cloud/conda-forge/noarch::uritemplate-3.0.1-py_0The following packages will be UPDATED:djangorestframewo~ anaconda/cloud/conda-forge/win-64::dj~ --> anaconda/cloud/conda-forge/noarch::djangorestframework-3.9.4-py_0The following packages will be SUPERSEDED by a higher-priority channel:done(python27) C:\Users\DELL>
conda deaactivate 退出环境
conda deactivate
(python27) C:\Users\DELL>conda deactivateC:\Users\DELL>
退出后,前面的env名称消失
其它命令
参考: https://zhuanlan.zhihu.com/p/44398592
# 安装packageconda install -n py35 numpy# 如果不用-n指定环境名称,则被安装在当前活跃环境# 也可以通过-c指定通过某个channel安装
C:\Users\DELL>conda list --helpusage: conda-script.py list [-h] [-n ENVIRONMENT | -p PATH] [--json] [-v] [-q] [--show-channel-urls] [-c] [-f] [--explicit] [--md5] [-e] [-r][--no-pip][regex]List linked packages in a conda environment.Options:positional arguments:regex List only packages matching this regular expression.optional arguments:-h, --help Show this help message and exit.--show-channel-urls Show channel urls. Overrides the value given by `conda config --show show_channel_urls`.-c, --canonical Output canonical names of packages only. Implies --no-pip.-f, --full-name Only search for full names, i.e., ^<regex>$.--explicit List explicitly all installed conda packaged with URL (output may be used by conda create --file).--md5 Add MD5 hashsum when using --explicit-e, --export Output requirement string only (output may be used by conda create --file).-r, --revisions List the revision history and exit.--no-pip Do not include pip-only installed packages.Target Environment Specification:-n ENVIRONMENT, --name ENVIRONMENTName of environment.-p PATH, --prefix PATHFull path to environment location (i.e. prefix).Output, Prompt, and Flow Control Options:--json Report all output as json. Suitable for using conda programmatically.-v, --verbose Use once for info, twice for debug, three times for trace.-q, --quiet Do not display progress bar.Examples:List all packages in the current environment::conda listList all packages installed into the environment 'myenv'::conda list -n myenvSave packages for future use::conda list --export > package-list.txtReinstall packages from an export file::conda create -n myenv --file package-list.txtC:\Users\DELL>conda list --name python36 # 查看python36环境安装的package# packages in environment at D:\devTools\Python\Miniconda3\envs\python36:## Name Version Build Channelcertifi 2020.6.20 pyhd3eb1b0_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/mainpip 20.0.2 py36_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython 3.6.15 h39d44d4_0_cpython https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgepython_abi 3.6 2_cp36m https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgesetuptools 49.6.0 py36ha15d459_3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeucrt 10.0.20348.0 h57928b3_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgevc 14.2 hb210afc_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgevs2015_runtime 14.29.30037 h902a5da_6 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewheel 0.37.1 pyhd8ed1ab_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgewincertstore 0.2 py36ha15d459_1006 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forgeC:\Users\DELL>
conda 使用不同的bit python
切换 win-32:set CONDA_FORCE_32BIT=1
在 cmd 运行 set CONDA_FORCE_32BIT=1 ,标识当前为 32 位的环境
Microsoft Windows [版本 10.0.18363.1556](c) 2019 Microsoft Corporation。保留所有权利。## 查看环境,其中 platform 现在是 win-64C:\Users\DELL>conda infoactive environment : Noneuser config file : C:\Users\DELL\.condarcpopulated config files : C:\Users\DELL\.condarcconda version : 4.11.0conda-build version : not installedpython version : 3.9.7.final.0virtual packages : __win=0=0__archspec=1=x86_64base environment : D:\devTools\Python\Miniconda3 (writable)conda av data dir : D:\devTools\Python\Miniconda3\etc\condaconda av metadata url : Nonechannel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-64https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-64https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-64https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\devTools\Python\Miniconda3\pkgsC:\Users\DELL\.conda\pkgsC:\Users\DELL\AppData\Local\conda\conda\pkgsenvs directories : D:\devTools\Python\Miniconda3\envsC:\Users\DELL\.conda\envsC:\Users\DELL\AppData\Local\conda\conda\envsplatform : win-64user-agent : conda/4.11.0 requests/2.27.1 CPython/3.9.7 Windows/10 Windows/10.0.18363administrator : Falsenetrc file : Noneoffline mode : False## 设置为32 位C:\Users\DELL>set CONDA_FORCE_32BIT=1## 再次查看,现在 platform 就是 win-32, 就可以正常安装需要的 32 位的 python 了C:\Users\DELL>conda infoactive environment : Noneuser config file : C:\Users\DELL\.condarcpopulated config files : C:\Users\DELL\.condarcconda version : 4.11.0conda-build version : not installedpython version : 3.9.7.final.0virtual packages : __win=0=0__archspec=1=x86base environment : D:\devTools\Python\Miniconda3 (writable)conda av data dir : D:\devTools\Python\Miniconda3\etc\condaconda av metadata url : Nonechannel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-32https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-32https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-32https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\devTools\Python\Miniconda3\pkgs32C:\Users\DELL\.conda\pkgs32C:\Users\DELL\AppData\Local\conda\conda\pkgs32envs directories : D:\devTools\Python\Miniconda3\envsC:\Users\DELL\.conda\envsC:\Users\DELL\AppData\Local\conda\conda\envsplatform : win-32user-agent : conda/4.11.0 requests/2.27.1 CPython/3.9.7 Windows/10 Windows/10.0.18363administrator : Falsenetrc file : Noneoffline mode : FalseC:\Users\DELL>
切换 win-64:set CONDA_FORCE_32BIT=0
C:\Users\DELL>conda infoactive environment : Noneuser config file : C:\Users\DELL\.condarcpopulated config files : C:\Users\DELL\.condarcconda version : 4.11.0conda-build version : not installedpython version : 3.9.7.final.0virtual packages : __win=0=0__archspec=1=x86base environment : D:\devTools\Python\Miniconda3 (writable)conda av data dir : D:\devTools\Python\Miniconda3\etc\condaconda av metadata url : Nonechannel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-32https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-32https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-32https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-32https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\devTools\Python\Miniconda3\pkgs32C:\Users\DELL\.conda\pkgs32C:\Users\DELL\AppData\Local\conda\conda\pkgs32envs directories : D:\devTools\Python\Miniconda3\envsC:\Users\DELL\.conda\envsC:\Users\DELL\AppData\Local\conda\conda\envsplatform : win-32user-agent : conda/4.11.0 requests/2.27.1 CPython/3.9.7 Windows/10 Windows/10.0.18363administrator : Falsenetrc file : Noneoffline mode : False## 切换回到 win-64C:\Users\DELL>set CONDA_FORCE_32BIT=0C:\Users\DELL>C:\Users\DELL>C:\Users\DELL>conda infoactive environment : Noneuser config file : C:\Users\DELL\.condarcpopulated config files : C:\Users\DELL\.condarcconda version : 4.11.0conda-build version : not installedpython version : 3.9.7.final.0virtual packages : __win=0=0__archspec=1=x86_64base environment : D:\devTools\Python\Miniconda3 (writable)conda av data dir : D:\devTools\Python\Miniconda3\etc\condaconda av metadata url : Nonechannel URLs : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarchhttps://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarchhttps://repo.anaconda.com/pkgs/main/win-64https://repo.anaconda.com/pkgs/main/noarchhttps://repo.anaconda.com/pkgs/r/win-64https://repo.anaconda.com/pkgs/r/noarchhttps://repo.anaconda.com/pkgs/msys2/win-64https://repo.anaconda.com/pkgs/msys2/noarchpackage cache : D:\devTools\Python\Miniconda3\pkgsC:\Users\DELL\.conda\pkgsC:\Users\DELL\AppData\Local\conda\conda\pkgsenvs directories : D:\devTools\Python\Miniconda3\envsC:\Users\DELL\.conda\envsC:\Users\DELL\AppData\Local\conda\conda\envsplatform : win-64user-agent : conda/4.11.0 requests/2.27.1 CPython/3.9.7 Windows/10 Windows/10.0.18363administrator : Falsenetrc file : Noneoffline mode : FalseC:\Users\DELL>
