[英]How do I update Anaconda?
I have Anaconda installed on my computer and I'd like to update it.我的电脑上安装了 Anaconda,我想更新它。 In Navigator I can see that there are several individual packages that can be updated, but also an anaconda
package that sometimes has a version number and sometimes says custom
.在 Navigator 中,我可以看到有几个单独的包可以更新,还有一个anaconda
包,有时有版本号,有时会显示custom
。 How do I proceed?我该如何进行?
root
is the old (pre-conda 4.4) name for the main environment;root
是主环境的旧名称(conda 4.4 之前); after conda 4.4, it was renamed to bebase
.在 conda 4.4 之后,它被重命名为base
。 source资源
In most cases what you want to do when you say that you want to update Anaconda is to execute the command:在大多数情况下,当您说要更新 Anaconda 时,您要做的是执行以下命令:
conda update --all
(But this should be preceded by conda update -n base conda
so you have the latest conda
version installed) (但这应该在conda update -n base conda
之前,这样你就安装了最新的conda
版本)
This will update all packages in the current environment to the latest version -- with the small print being that it may use an older version of some packages in order to satisfy dependency constraints (often this won't be necessary and when it is necessary the package plan solver will do its best to minimize the impact).这会将当前环境中的所有包更新到最新版本 - 小字是它可能使用某些包的旧版本以满足依赖约束(通常这不是必需的,当有必要时包计划求解器将尽最大努力将影响降至最低)。
This needs to be executed from the command line, and the best way to get there is from Anaconda Navigator, then the "Environments" tab, then click on the triangle beside the base
environment, selecting "Open Terminal":这需要从命令行执行,最好的方法是从 Anaconda Navigator,然后是“环境”选项卡,然后单击base
环境旁边的三角形,选择“打开终端”:
This operation will only update the one selected environment (in this case, the base
environment).此操作只会更新一个选定的环境(在本例中为base
环境)。 If you have other environments you'd like to update you can repeat the process above, but first click on the environment.如果您有其他想要更新的环境,您可以重复上述过程,但首先单击环境。 When it is selected there is a triangular marker on the right (see image above, step 3).当它被选中时,右侧有一个三角形标记(见上图,第 3 步)。 Or from the command line you can provide the environment name ( -n envname
) or path ( -p /path/to/env
), for example to update your dspyr
environment from the screenshot above:或者从命令行,您可以提供环境名称 ( -n envname
) 或路径 ( -p /path/to/env
),例如从上面的屏幕截图更新您的dspyr
环境:
conda update -n dspyr --all
If you are only interested in updating an individual package then simply click on the blue arrow or blue version number in Navigator, eg for astroid
or astropy
in the screenshot above, and this will tag those packages for an upgrade.如果您只对更新单个包感兴趣,那么只需单击导航器中的蓝色箭头或蓝色版本号,例如上面屏幕截图中的astroid
或astropy
,这将标记这些包以进行升级。 When you are done you need to click the "Apply" button:完成后,您需要单击“应用”按钮:
Or from the command line:或者从命令行:
conda update astroid astropy
If you don't care about package versions and just want "the latest set of all packages in the standard Anaconda Distribution, so long as they work together" , then you should take a look at this gist .如果您不关心软件包版本,而只想要“标准 Anaconda 发行版中所有软件包的最新集,只要它们一起工作” ,那么您应该看看这个要点。
In most cases updating the Anaconda package in the package list will have a surprising result: you may actually downgrade many packages (in fact, this is likely if it indicates the version as custom
).在大多数情况下,更新软件包列表中的 Anaconda 软件包会产生令人惊讶的结果:您实际上可能会降级许多软件包(实际上,如果它指示版本为custom
,这很可能)。 The gist above provides details.上面的要点提供了详细信息。
Your base
environment is probably not a good place to try and manage an exact set of packages: it is going to be a dynamic working space with new packages installed and packages randomly updated.您的base
环境可能不是一个尝试和管理一组精确软件包的好地方:它将是一个动态的工作空间,其中安装了新的软件包并随机更新了软件包。 If you need an exact set of packages then create a conda environment to hold them.如果您需要一组精确的包,请创建一个 conda 环境来保存它们。 Thanks to the conda package cache and the way file linking is used doing this is typically i) fast and ii) consumes very little additional disk space.由于 conda 包缓存和使用文件链接的方式,这样做通常是 i) 快速且 ii) 消耗的额外磁盘空间非常少。 Eg例如
conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk
The conda documentation has more details and examples. conda 文档有更多详细信息和示例。
None of this is going to help with updating packages that have been installed from PyPI via pip
or any packages installed using python setup.py install
.这些都无助于更新通过pip
从 PyPI 安装的软件包或使用python setup.py install
的任何软件包。 conda list
will give you some hints about the pip-based Python packages you have in an environment, but it won't do anything special to update them. conda list
会给你一些关于你在环境中基于 pip 的 Python 包的提示,但它不会做任何特别的更新它们。
It is pretty much exactly the same story, with the exception that you may not be able to update the base
environment if it was installed by someone else (say to /opt/anaconda/latest
).这几乎是完全相同的故事,除了如果它是由其他人安装的(例如/opt/anaconda/latest
),您可能无法更新base
环境。 If you're not able to update the environments you are using you should be able to clone and then update:如果您无法更新您正在使用的环境,您应该能够克隆然后更新:
conda create -n myenv --clone base
conda update -n myenv --all
If you are trying to update your Anaconda version to a new one, you'll notice that running the new installer wouldn't work, as it complains the installation directory is non-empty.如果您尝试将 Anaconda 版本更新为新版本,您会注意到运行新的安装程序将不起作用,因为它抱怨安装目录非空。
So you should use conda to upgrade as detailed by the official docs :因此,您应该按照官方文档的详细说明使用 conda 进行升级:
conda update conda
conda update anaconda
This prevents the error:这可以防止错误:
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py36_0'.错误 conda.core.link:_execute(502):卸载包“defaults::conda-4.5.4-py36_0”时出错。 PermissionError(13, 'Access is denied') PermissionError(13, '访问被拒绝')
Open "command or conda prompt" and run:打开“命令或 conda 提示符”并运行:
conda update conda
conda update anaconda
It's a good idea to run both command twice (one after the other) to be sure that all the basic files are updated.最好同时运行这两个命令两次(一个接一个)以确保所有基本文件都已更新。
This should put you back on the latest 'releases', which contains packages that are selected by the people at Continuum to work well together.这应该让您回到最新的“版本”,其中包含由 Continuum 的人员选择的可以很好地协同工作的包。
If you want the last version of each package run (this can lead to an unstable environment ):如果您希望每个包的最后一个版本运行(这可能导致环境不稳定):
conda update --all
Hope this helps.希望这可以帮助。
Sources:资料来源:
This is what the official Anaconda documentation recommends:这是Anaconda 官方文档的建议:
conda update conda
conda install anaconda=2021.11
You can find the current and past version codes here .您可以在此处找到当前和过去的版本代码。
The command will update to a specific release of the Anaconda meta-package.该命令将更新到 Anaconda 元包的特定版本。
I feel like (contrary to the claim made in the accepted answer) this is more what 95% of Anaconda users want imho: Upgrading to the latest version of the Anaconda meta-package (put together and tested by the Anaconda Distributors) and ignoring the update status of individual packages, which would be issued by conda update --all
.我觉得(与接受的答案中的说法相反)这更像是 95% 的 Anaconda 用户想要恕我直言:升级到最新版本的 Anaconda 元包(由 Anaconda 分销商组合和测试)并忽略单个软件包的更新状态,将由conda update --all
发布。
Here's the best practice (in my humble experience).这是最佳实践(以我的卑微经验)。 Selecting these four packages will also update all other dependencies to the appropriate versions that will help you keep your environment consistent.选择这四个包还会将所有其他依赖项更新到适当的版本,这将帮助您保持环境的一致性。 The latter is a common problem others have expressed in earlier responses.后者是其他人在之前的回复中表达的常见问题。 This solution doesn't need the terminal.此解决方案不需要终端。
Open Anaconda cmd in base mode:在基本模式下打开 Anaconda cmd:
Then use conda update conda to update Anaconda.然后使用conda update conda来更新 Anaconda。
You can then use conda update --all to update all the requirements for Anaconda:然后,您可以使用conda update --all更新 Anaconda 的所有要求:
conda update conda
conda update --all
If you have trouble to get eg from 3.3.x to 4.x (conda update conda "does not work" to get to the next version) than try it more specific like so:如果您无法从 3.3.x 升级到 4.x(conda 更新 conda“无法”进入下一个版本),请尝试更具体的方法,如下所示:
conda install conda=4.0 (or conda install anaconda=4.0)
https://www.anaconda.com/blog/developer-blog/anaconda-4-release/ https://www.anaconda.com/blog/developer-blog/anaconda-4-release/
You should know what you do, because conda could break due to the forced installation.您应该知道自己在做什么,因为 conda 可能会因强制安装而中断。 If you would like to get more flexibility/security you could use pkg-manager like nix(-pkgs) [with nix-shell] / NixOS.如果您想获得更多的灵活性/安全性,您可以使用 pkg-manager,例如 nix(-pkgs) [with nix-shell] / NixOS。
Yet, another answer:然而,另一个答案:
conda update -n base conda -c anaconda
where -c
your preferred channel or simply leave out.其中-c
您的首选频道或干脆省略。
I'm using Windows 10. The following updates everything and also installs some new packages, including a Python update (for me it was 3.7.3).我正在使用 Windows 10。以下内容会更新所有内容并安装一些新软件包,包括 Python 更新(对我来说是 3.7.3)。
At the shell, try the following (be sure to change where your Anaconda 3 Data is installed).在 shell 中,尝试以下操作(确保更改 Anaconda 3 Data 的安装位置)。 It takes some time to update everything.更新所有内容需要一些时间。
conda update --prefix X:\XXXXData\Anaconda3 anaconda
To update your installed version to the latest version, say 2019.07, run:要将已安装的版本更新到最新版本,例如 2019.07,请运行:
conda install anaconda=2019.07
In most cases, this method can meet your needs and avoid dependency problems.在大多数情况下,这种方法可以满足您的需求并避免依赖问题。
This answer wraps up many answers and comments, it does not add new code, all credits go to the other answers, especially this answer that shows how to install the official release, fully in line with the docs .这个答案包含了许多答案和评论,它没有添加新代码,所有学分都归于其他答案,尤其是这个答案,它显示了如何安装官方版本,完全符合文档。
In the following, the "docs" mean the official Anaconda documentation at Updating from older versions .在下文中,“文档”是指从旧版本更新中的官方 Anaconda 文档。 It makes sense to read the docs, it is a short overview.阅读文档很有意义,这是一个简短的概述。
And since it will be used quite often, here is the definition of metapackage :由于它会经常使用,这里是metapackage 的定义:
A metapackage is a very simple package that has at least a name and a version.元包是一个非常简单的包,它至少有一个名称和一个版本。 It need not have any dependencies or build steps.它不需要任何依赖项或构建步骤。 Metapackages may list dependencies to several core, low-level libraries and may contain links to software files that are automatically downloaded when executed.元包可能会列出对几个核心、低级库的依赖关系,并且可能包含指向在执行时自动下载的软件文件的链接。
As a first step before the anaconda install, you update conda:作为安装 anaconda 之前的第一步,您更新 conda:
conda update conda
As a second step, you have three choices: custom or official metapackage, or conda update --all
.第二步,您有三个选择:自定义或官方元包,或conda update --all
。
If you are allowed to have the most recent custom metapackage (mind that this might not always be the best choice for standard packages with constrained dependencies), then you can use如果您被允许拥有最新的自定义元包(请注意,对于具有受限依赖项的标准包,这可能并不总是最佳选择),那么您可以使用
conda install anaconda
Docs:文件:
There is a special “custom” version of the Anaconda metapackage that has all the package dependencies, but none of them are constrained. Anaconda 元包有一个特殊的“自定义”版本,它具有所有包依赖项,但它们都不受限制。 The “custom” version is lower in version ordering than any actual release number. “自定义”版本的版本排序低于任何实际版本号。
The starting point for the tests was the installed release 2021.05
.测试的起点是安装的版本2021.05
。 After this, conda update anaconda
and conda install anaconda
both lead to the same new "downgraded custom version" of custom-py38_1
, see at the bottom of the code blocks: version change of anaconda
= 2021.05-py38_0 --> custom-py38_1
.在此之后, conda update anaconda
和conda install anaconda
都导致custom-py38_1
的新“降级自定义版本”,见代码块底部:版本更改anaconda
= 2021.05-py38_0 --> custom-py38_1
。 But using update
leads to far more installed packages than install
here:但是使用update
导致安装的软件包比在此处install
要多得多:
update
leads to more installation steps than install
update
导致比install
更多的安装步骤(base) C:\WINDOWS\system32>conda update anaconda
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\toeft\anaconda3
added / updated specs:
- anaconda
The following packages will be downloaded:
package | build
---------------------------|-----------------
_anaconda_depends-2020.07 | py38_0 6 KB
anaconda-custom | py38_1 36 KB
anaconda-client-1.8.0 | py38haa95532_0 170 KB
anaconda-project-0.10.1 | pyhd3eb1b0_0 218 KB
astroid-2.6.6 | py38haa95532_0 314 KB
astropy-4.3.1 | py38hc7d831d_0 6.1 MB
attrs-21.2.0 | pyhd3eb1b0_0 46 KB
babel-2.9.1 | pyhd3eb1b0_0 5.5 MB
...
xlsxwriter-3.0.1 | pyhd3eb1b0_0 111 KB
xlwings-0.24.7 | py38haa95532_0 887 KB
zeromq-4.3.4 | hd77b12b_0 4.2 MB
zipp-3.5.0 | pyhd3eb1b0_0 13 KB
zope.interface-5.4.0 | py38h2bbff1b_0 305 KB
zstd-1.4.9 | h19a0ad4_0 478 KB
------------------------------------------------------------
Total: 218.2 MB
The following NEW packages will be INSTALLED:
_anaconda_depends pkgs/main/win-64::_anaconda_depends-2020.07-py38_0
cfitsio pkgs/main/win-64::cfitsio-3.470-he774522_6
charset-normalizer pkgs/main/noarch::charset-normalizer-2.0.4-pyhd3eb1b0_0
conda-pack pkgs/main/noarch::conda-pack-0.6.0-pyhd3eb1b0_0
debugpy pkgs/main/win-64::debugpy-1.4.1-py38hd77b12b_0
fonttools pkgs/main/noarch::fonttools-4.25.0-pyhd3eb1b0_0
gmpy2 pkgs/main/win-64::gmpy2-2.0.8-py38h7edee0f_3
libllvm9 pkgs/main/win-64::libllvm9-9.0.1-h21ff451_0
matplotlib-inline pkgs/main/noarch::matplotlib-inline-0.1.2-pyhd3eb1b0_2
mpc pkgs/main/win-64::mpc-1.1.0-h7edee0f_1
mpfr pkgs/main/win-64::mpfr-4.0.2-h62dcd97_1
mpir pkgs/main/win-64::mpir-3.0.0-hec2e145_1
munkres pkgs/main/noarch::munkres-1.1.4-py_0
The following packages will be REMOVED:
jupyter-packaging-0.7.12-pyhd3eb1b0_0
The following packages will be UPDATED:
anaconda-client 1.7.2-py38_0 --> 1.8.0-py38haa95532_0
anaconda-project 0.9.1-pyhd3eb1b0_1 --> 0.10.1-pyhd3eb1b0_0
astroid 2.5-py38haa95532_1 --> 2.6.6-py38haa95532_0
astropy 4.2.1-py38h2bbff1b_1 --> 4.3.1-py38hc7d831d_0
attrs 20.3.0-pyhd3eb1b0_0 --> 21.2.0-pyhd3eb1b0_0
babel 2.9.0-pyhd3eb1b0_0 --> 2.9.1-pyhd3eb1b0_0
bitarray 1.9.2-py38h2bbff1b_1 --> 2.3.0-py38h2bbff1b_1
bleach 3.3.0-pyhd3eb1b0_0 --> 4.0.0-pyhd3eb1b0_0
bokeh 2.3.2-py38haa95532_0 --> 2.3.3-py38haa95532_0
ca-certificates 2021.4.13-haa95532_1 --> 2021.7.5-haa95532_1
certifi 2020.12.5-py38haa95532_0 --> 2021.5.30-py38haa95532_0
cffi 1.14.5-py38hcd4344a_0 --> 1.14.6-py38h2bbff1b_0
click 7.1.2-pyhd3eb1b0_0 --> 8.0.1-pyhd3eb1b0_0
comtypes 1.1.9-py38haa95532_1002 --> 1.1.10-py38haa95532_1002
curl 7.71.1-h2a8f88b_1 --> 7.78.0-h86230a5_0
cython 0.29.23-py38hd77b12b_0 --> 0.29.24-py38hd77b12b_0
dask 2021.4.0-pyhd3eb1b0_0 --> 2021.8.1-pyhd3eb1b0_0
dask-core 2021.4.0-pyhd3eb1b0_0 --> 2021.8.1-pyhd3eb1b0_0
decorator 5.0.6-pyhd3eb1b0_0 --> 5.0.9-pyhd3eb1b0_0
distributed 2021.4.0-py38haa95532_0 --> 2021.8.1-py38haa95532_0
docutils 0.17-py38haa95532_1 --> 0.17.1-py38haa95532_1
et_xmlfile pkgs/main/noarch::et_xmlfile-1.0.1-py~ --> pkgs/main/win-64::et_xmlfile-1.1.0-py38haa95532_0
fsspec 0.9.0-pyhd3eb1b0_0 --> 2021.7.0-pyhd3eb1b0_0
gevent 21.1.2-py38h2bbff1b_1 --> 21.8.0-py38h2bbff1b_1
greenlet 1.0.0-py38hd77b12b_2 --> 1.1.1-py38hd77b12b_0
idna 2.10-pyhd3eb1b0_0 --> 3.2-pyhd3eb1b0_0
imagecodecs 2021.3.31-py38h5da4933_0 --> 2021.6.8-py38h5da4933_0
intel-openmp 2021.2.0-haa95532_616 --> 2021.3.0-haa95532_3372
ipykernel 5.3.4-py38h5ca1d4c_0 --> 6.2.0-py38haa95532_1
ipython 7.22.0-py38hd4e2768_0 --> 7.26.0-py38hd4e2768_0
isort 5.8.0-pyhd3eb1b0_0 --> 5.9.3-pyhd3eb1b0_0
itsdangerous 1.1.0-pyhd3eb1b0_0 --> 2.0.1-pyhd3eb1b0_0
jinja2 2.11.3-pyhd3eb1b0_0 --> 3.0.1-pyhd3eb1b0_0
json5 0.9.5-py_0 --> 0.9.6-pyhd3eb1b0_0
jupyterlab 3.0.14-pyhd3eb1b0_1 --> 3.1.7-pyhd3eb1b0_0
jupyterlab_server 2.4.0-pyhd3eb1b0_0 --> 2.7.1-pyhd3eb1b0_0
keyring 22.3.0-py38haa95532_0 --> 23.0.1-py38haa95532_0
krb5 1.18.2-hc04afaa_0 --> 1.19.2-h5b6d351_0
libcurl 7.71.1-h2a8f88b_1 --> 7.78.0-h86230a5_0
libxml2 2.9.10-hb89e7f3_3 --> 2.9.12-h0ad7f3c_0
lz4-c 1.9.3-h2bbff1b_0 --> 1.9.3-h2bbff1b_1
markupsafe 1.1.1-py38he774522_0 --> 2.0.1-py38h2bbff1b_0
matplotlib 3.3.4-py38haa95532_0 --> 3.4.2-py38haa95532_0
matplotlib-base 3.3.4-py38h49ac443_0 --> 3.4.2-py38h49ac443_0
mkl 2021.2.0-haa95532_296 --> 2021.3.0-haa95532_524
mkl-service 2.3.0-py38h2bbff1b_1 --> 2.4.0-py38h2bbff1b_0
mkl_random 1.2.1-py38hf11a4ad_2 --> 1.2.2-py38hf11a4ad_0
more-itertools 8.7.0-pyhd3eb1b0_0 --> 8.8.0-pyhd3eb1b0_0
nbconvert 6.0.7-py38_0 --> 6.1.0-py38haa95532_0
networkx 2.5-py_0 --> 2.6.2-pyhd3eb1b0_0
nltk 3.6.1-pyhd3eb1b0_0 --> 3.6.2-pyhd3eb1b0_0
notebook 6.3.0-py38haa95532_0 --> 6.4.3-py38haa95532_0
numpy 1.20.1-py38h34a8a5c_0 --> 1.20.3-py38ha4e8547_0
numpy-base 1.20.1-py38haf7ebc8_0 --> 1.20.3-py38hc2deb75_0
openjpeg 2.3.0-h5ec785f_1 --> 2.4.0-h4fc8c34_0
openssl 1.1.1k-h2bbff1b_0 --> 1.1.1l-h2bbff1b_0
packaging 20.9-pyhd3eb1b0_0 --> 21.0-pyhd3eb1b0_0
pandas 1.2.4-py38hd77b12b_0 --> 1.3.2-py38h6214cd6_0
path 15.1.2-py38haa95532_0 --> 16.0.0-py38haa95532_0
pathlib2 2.3.5-py38haa95532_2 --> 2.3.6-py38haa95532_2
pillow 8.2.0-py38h4fa10fc_0 --> 8.3.1-py38h4fa10fc_0
pkginfo 1.7.0-py38haa95532_0 --> 1.7.1-py38haa95532_0
prometheus_client 0.10.1-pyhd3eb1b0_0 --> 0.11.0-pyhd3eb1b0_0
pydocstyle 6.0.0-pyhd3eb1b0_0 --> 6.1.1-pyhd3eb1b0_0
pyerfa 1.7.3-py38h2bbff1b_0 --> 2.0.0-py38h2bbff1b_0
pygments 2.8.1-pyhd3eb1b0_0 --> 2.10.0-pyhd3eb1b0_0
pylint 2.7.4-py38haa95532_1 --> 2.9.6-py38haa95532_1
pyodbc 4.0.30-py38ha925a31_0 --> 4.0.31-py38hd77b12b_0
pytest 6.2.3-py38haa95532_2 --> 6.2.4-py38haa95532_2
python-dateutil 2.8.1-pyhd3eb1b0_0 --> 2.8.2-pyhd3eb1b0_0
pywin32 227-py38he774522_1 --> 228-py38hbaba5e8_1
pyzmq 20.0.0-py38hd77b12b_1 --> 22.2.1-py38hd77b12b_1
qtconsole 5.0.3-pyhd3eb1b0_0 --> 5.1.0-pyhd3eb1b0_0
qtpy 1.9.0-py_0 --> 1.10.0-pyhd3eb1b0_0
regex 2021.4.4-py38h2bbff1b_0 --> 2021.8.3-py38h2bbff1b_0
requests 2.25.1-pyhd3eb1b0_0 --> 2.26.0-pyhd3eb1b0_0
rope 0.18.0-py_0 --> 0.19.0-pyhd3eb1b0_0
scikit-learn 0.24.1-py38hf11a4ad_0 --> 0.24.2-py38hf11a4ad_1
seaborn 0.11.1-pyhd3eb1b0_0 --> 0.11.2-pyhd3eb1b0_0
singledispatch 3.6.1-pyhd3eb1b0_1001 --> 3.7.0-pyhd3eb1b0_1001
six pkgs/main/win-64::six-1.15.0-py38haa9~ --> pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
sortedcontainers 2.3.0-pyhd3eb1b0_0 --> 2.4.0-pyhd3eb1b0_0
sphinx 4.0.1-pyhd3eb1b0_0 --> 4.0.2-pyhd3eb1b0_0
sphinxcontrib-htm~ 1.0.3-pyhd3eb1b0_0 --> 2.0.0-pyhd3eb1b0_0
sphinxcontrib-ser~ 1.1.4-pyhd3eb1b0_0 --> 1.1.5-pyhd3eb1b0_0
sqlalchemy 1.4.7-py38h2bbff1b_0 --> 1.4.22-py38h2bbff1b_0
sqlite 3.35.4-h2bbff1b_0 --> 3.36.0-h2bbff1b_0
testpath 0.4.4-pyhd3eb1b0_0 --> 0.5.0-pyhd3eb1b0_0
threadpoolctl 2.1.0-pyh5ca1d4c_0 --> 2.2.0-pyhbf3da8f_0
tifffile 2021.4.8-pyhd3eb1b0_2 --> 2021.7.2-pyhd3eb1b0_2
tqdm 4.59.0-pyhd3eb1b0_1 --> 4.62.1-pyhd3eb1b0_1
typed-ast 1.4.2-py38h2bbff1b_1 --> 1.4.3-py38h2bbff1b_1
typing_extensions 3.7.4.3-pyha847dfd_0 --> 3.10.0.0-pyh06a4308_0
urllib3 1.26.4-pyhd3eb1b0_0 --> 1.26.6-pyhd3eb1b0_1
wheel 0.36.2-pyhd3eb1b0_0 --> 0.37.0-pyhd3eb1b0_0
xlsxwriter 1.3.8-pyhd3eb1b0_0 --> 3.0.1-pyhd3eb1b0_0
xlwings 0.23.0-py38haa95532_0 --> 0.24.7-py38haa95532_0
zeromq 4.3.3-ha925a31_3 --> 4.3.4-hd77b12b_0
zipp 3.4.1-pyhd3eb1b0_0 --> 3.5.0-pyhd3eb1b0_0
zope.interface 5.3.0-py38h2bbff1b_0 --> 5.4.0-py38h2bbff1b_0
zstd 1.4.5-h04227a9_0 --> 1.4.9-h19a0ad4_0
The following packages will be DOWNGRADED:
anaconda 2021.05-py38_0 --> custom-py38_1
install
leads to less installation steps than update
: install
导致安装步骤少于update
:(base) C:\WINDOWS\system32>conda install anaconda
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\toeft\anaconda3
added / updated specs:
- anaconda
The following packages will be downloaded:
package | build
---------------------------|-----------------
_anaconda_depends-2020.07 | py38_0 6 KB
anaconda-custom | py38_1 36 KB
ca-certificates-2021.7.5 | haa95532_1 113 KB
certifi-2021.5.30 | py38haa95532_0 140 KB
gmpy2-2.0.8 | py38h7edee0f_3 145 KB
libllvm9-9.0.1 | h21ff451_0 61 KB
mpc-1.1.0 | h7edee0f_1 260 KB
mpfr-4.0.2 | h62dcd97_1 1.5 MB
mpir-3.0.0 | hec2e145_1 1.3 MB
openssl-1.1.1l | h2bbff1b_0 4.8 MB
------------------------------------------------------------
Total: 8.4 MB
The following NEW packages will be INSTALLED:
_anaconda_depends pkgs/main/win-64::_anaconda_depends-2020.07-py38_0
gmpy2 pkgs/main/win-64::gmpy2-2.0.8-py38h7edee0f_3
libllvm9 pkgs/main/win-64::libllvm9-9.0.1-h21ff451_0
mpc pkgs/main/win-64::mpc-1.1.0-h7edee0f_1
mpfr pkgs/main/win-64::mpfr-4.0.2-h62dcd97_1
mpir pkgs/main/win-64::mpir-3.0.0-hec2e145_1
The following packages will be UPDATED:
ca-certificates 2021.4.13-haa95532_1 --> 2021.7.5-haa95532_1
certifi 2020.12.5-py38haa95532_0 --> 2021.5.30-py38haa95532_0
openssl 1.1.1k-h2bbff1b_0 --> 1.1.1l-h2bbff1b_0
The following packages will be DOWNGRADED:
anaconda 2021.05-py38_0 --> custom-py38_1
In the following code snippets, update
and install
lead to the same results.在以下代码片段中, update
和install
导致相同的结果。 I use install
like in the docs.我在文档中使用install
。
If you do not want to install a custom version of the metapackage but rather need the most recent official release, install with如果您不想安装元包的自定义版本,而是需要最新的官方版本,请安装
conda install anaconda=VersionNumber
At the time of writing, in 09/2021, the latest available release (Anaconda individual edition) is在撰写本文时,2021 年 9 月,最新可用版本(Anaconda 个人版)是
conda install anaconda=2021.05
But how to get hold of this VersionNumber
?但是如何获得这个VersionNumber
呢?
Have a look at the Anaconda Release notes of the individual edition .查看个人版的 Anaconda 发行说明。 If you need an older version, you need to scroll down that page, for example to find 2020.11
.如果您需要旧版本,则需要向下滚动该页面,例如找到2020.11
。 The most recent is always on top of the page.最新的总是在页面的顶部。 If you use a commercial edition, you need to check other release notes.如果您使用商业版,则需要查看其他发行说明。
Thus, something like the 2021.05
version code is the latest release shortcut that you need to find.因此, 2021.05
版本代码之类的内容是您需要找到的最新发布快捷方式。 You can also find the full version name of your OS like for example Anaconda3-2021.05-Windows-x86_64.exe
in the list of available Anaconda versions that is directly linked in the docs.您还可以在文档中直接链接的可用 Anaconda 版本列表中找到操作系统的完整版本名称,例如Anaconda3-2021.05-Windows-x86_64.exe
。 It is sorted by name and date, thus, you need to search for the year like "YYYY-MM" / "YYYY-" or scroll through the whole list to find the most recent versions:它按名称和日期排序,因此,您需要搜索年份,如“YYYY-MM”/“YYYY-”或滚动整个列表以查找最新版本:
For the example of Windows 10 64 bit, the command could as well be:对于 Windows 10 64 位的示例,该命令也可以是:
conda update anaconda=Anaconda3-2021.05-Windows-x86_64.exe
If you install a release after having installed the most recent custom metapackage, you will see some packages to be removed and quite many to be downgraded slightly.如果您在安装了最新的自定义元包后安装了一个版本,您会看到一些包被删除并且相当多的包被轻微降级。 This is because the release is slightly back in time, but therefore also fully trusted.这是因为该版本的时间稍早一些,但因此也完全受信任。
Docs:文件:
conda update anaconda=VersionNumber
grabs the specific release of the Anaconda metapackage, for exampleconda update anaconda=2019.10
.conda update anaconda=VersionNumber
获取 Anaconda 元包的特定版本,例如conda update anaconda=2019.10
。 That metapackage represents a pinned state that has undergone testing as a collection.该元包表示已作为集合进行测试的固定状态。
conda update --all
3. 不要使用conda update --all
As to the docs (last sentence of the following quote below), installing the custom (= most recent) metapackage of 2019.07
can be done as well by running至于文档(下面引用的最后一句),安装2019.07
的自定义(=最新)元包也可以通过运行来完成
conda update --all
and if you have virtual environments, you need:如果你有虚拟环境,你需要:
conda update -n myenv --all
YET: This was probably an exception for 2019.07
. YET:这可能是2019.07
的一个例外。 It does not seem to hold for higher metapackage versions.它似乎不适用于更高的元包版本。 I checked the differences of conda update --all
against conda update anaconda
on a row to row comparison (see below, after the quote).我在逐行比较中检查了conda update --all
与conda update anaconda
的差异(见下文,引用后)。 Although they seem like twins at first, there were enough small differences to say that you should keep your hands off conda update --all
since possible conflicting constraints are even mentioned in the docs.尽管一开始它们看起来像双胞胎,但有足够小的差异表明您应该不动手进行conda update --all
——因为文档中甚至提到了可能的冲突约束。
Docs:文件:
conda update --all
will unpin everything.conda update --all
将取消固定所有内容。 This updates all packages in the current environment to the latest version.这会将当前环境中的所有包更新到最新版本。 In doing so, it drops all the version constraints from the history and tries to make everything as new as it can.这样做时,它会从历史记录中删除所有版本限制,并尝试使所有内容尽可能新。This has the same behavior with removing packages.这与删除包具有相同的行为。 If any packages are orphaned by an update, they are removed.如果任何包被更新孤立,它们将被删除。 conda update --all may not be able to make everything the latest versions because you may have conflicting constraints in your environment. conda update --all 可能无法使所有内容都成为最新版本,因为您的环境中可能存在冲突的约束。
With Anaconda 2019.07's newer Anaconda metapackage, conda update --all will make the metapackage go to the custom version in order to update other specs.使用 Anaconda 2019.07 更新的 Anaconda 元包, conda update --all 将使元包转到自定义版本以更新其他规范。
The whole output, put against each other on a row to row base, reveals the following remaining row differences.整个输出,在一行到一行的基础上相互对比,揭示了以下剩余的行差异。 This proves that conda update --all
is not just the custom metapackage:这证明conda update --all
不仅仅是自定义元包:
conda update --all
output lines not found in conda update anaconda
conda update --all
--在conda update anaconda
中找不到所有输出行(base) C:\WINDOWS\system32>conda update --all
The following packages will be downloaded:
anaconda-navigator-2.0.4 | py38_0 5.2 MB
conda-build-3.21.4 | py38haa95532_0 552 KB
conda-content-trust-0.1.1 | pyhd3eb1b0_0 56 KB
conda-repo-cli-1.0.4 | pyhd3eb1b0_0 47 KB
conda-token-0.3.0 | pyhd3eb1b0_0 10 KB
menuinst-1.4.17 | py38h59b6b97_0 96 KB
python-3.8.11 | h6244533_1 16.0 MB
Total: 224.8 MB
The following NEW packages will be INSTALLED:
conda-content-tru~ pkgs/main/noarch::conda-content-trust-0.1.1-pyhd3eb1b0_0
conda-repo-cli pkgs/main/noarch::conda-repo-cli-1.0.4-pyhd3eb1b0_0
conda-token pkgs/main/noarch::conda-token-0.3.0-pyhd3eb1b0_0
The following packages will be UPDATED:
anaconda-navigator 1.10.0-py38_0 --> 2.0.4-py38_0
conda-build 3.20.5-py38_1 --> 3.21.4-py38haa95532_0
et_xmlfile pkgs/main/noarch::et_xmlfile-1.0.1-py~ --> pkgs/main/win-64::et_xmlfile-1.1.0-py38haa95532_0
menuinst 1.4.16-py38he774522_1 --> 1.4.17-py38h59b6b97_0
python 3.8.8-hdbf39b2_5 --> 3.8.11-h6244533_1
six pkgs/main/win-64::six-1.15.0-py38haa9~ --> pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
sphinxcontrib-htm~ 1.0.3-pyhd3eb1b0_0 --> 2.0.0-pyhd3eb1b0_0
sphinxcontrib-ser~ 1.1.4-pyhd3eb1b0_0 --> 1.1.5-pyhd3eb1b0_0
conda update anaconda
output lines not found in conda update --all
在conda update --all
中找不到conda update anaconda
输出行(base) C:\WINDOWS\system32>conda update anaconda
added / updated specs:
- anaconda
The following packages will be downloaded:
cfitsio-3.470 | he774522_6 512 KB
imagecodecs-2021.6.8 | py38h5da4933_0 6.1 MB
jinja2-3.0.1 | pyhd3eb1b0_0 110 KB
tifffile-2021.7.2 | pyhd3eb1b0_2 135 KB
typed-ast-1.4.3 | py38h2bbff1b_1 135 KB
Total: 209.8 MB
The following NEW packages will be INSTALLED:
cfitsio pkgs/main/win-64::cfitsio-3.470-he774522_6
The following packages will be UPDATED:
et_xmlfile pkgs/main/noarch::et_xmlfile-1.0.1-py~ --> pkgs/main/win-64::et_xmlfile-1.1.0-py38haa95532_0
imagecodecs 2021.3.31-py38h5da4933_0 --> 2021.6.8-py38h5da4933_0
jinja2 2.11.3-pyhd3eb1b0_0 --> 3.0.1-pyhd3eb1b0_0
six pkgs/main/win-64::six-1.15.0-py38haa9~ --> pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_0
sphinxcontrib-htm~ 1.0.3-pyhd3eb1b0_0 --> 2.0.0-pyhd3eb1b0_0
sphinxcontrib-ser~ 1.1.4-pyhd3eb1b0_0 --> 1.1.5-pyhd3eb1b0_0
tifffile 2021.4.8-pyhd3eb1b0_2 --> 2021.7.2-pyhd3eb1b0_2
typed-ast 1.4.2-py38h2bbff1b_1 --> 1.4.3-py38h2bbff1b_1
Therefore, conda update --all
is not recommended, better stick to the custom metapackage if you need the highest possible update, or take the official metapackage if you are fine with a lag of a couple of months and a collection of packages without any conflicts is most important (for example, if you are in a production environment).因此,不建议使用conda update --all
,如果您需要尽可能高的更新,最好坚持使用自定义元包,或者如果您可以延迟几个月并且没有任何冲突的包集合,请使用官方元包是最重要的(例如,如果您在生产环境中)。
Some answers or comments say that the custom metapackage install might need to be run twice to get to a proper state.一些答案或评论说自定义元包安装可能需要运行两次才能达到正确的状态。 I cannot confirm this (tested with conda install anaconda
and conda update anaconda
, but I am also in a fresh Python installation).我无法确认这一点(使用conda install anaconda
和conda update anaconda
进行了测试,但我也在全新的 Python 安装中)。 This is still a hint that it might be more stable to install the most recent official metapackage (= release, conda install anaconda=VersionNumber
= conda update anaconda=VersionNumber
) which can have a lag of some months.这仍然暗示安装最新的官方元包(= release, conda install anaconda=VersionNumber
= conda update anaconda=VersionNumber
)可能会更稳定,这可能会延迟几个月。
On the other hand, the custom metapackage (the most recent trusted package collection) might be good if you want the most recent versions available.另一方面,如果您想要最新版本可用,自定义元包(最新的受信任包集合)可能会很好。 Then run conda install anaconda
or the even stronger command conda update anaconda
.然后运行conda install anaconda
或更强大的命令conda update anaconda
。
This is also the way to update Spyder:这也是更新 Spyder 的方式:
They do not even use conda update conda
before conda update anaconda
, the latter seems enough.他们甚至在conda update anaconda
之前都不使用conda update conda
,后者似乎就足够了。
Small "proof": I used conda update conda
at first, and after that, conda update anaconda
had nothing to do anymore, conda update conda
had done all or the tasks.小“证明”:我一开始用的是conda update conda
,之后conda update anaconda
就什么都不干了, conda update conda
已经完成了所有或者任务。
conda update anaconda
Collecting package metadata (current_repodata.json): done Solving environment: done
# All requested packages already installed.
That again sounds as if both commands are made the same now, perhaps they have not been the same only in the past.这再次听起来好像两个命令现在都是一样的,也许它们只是在过去不一样。
The choice is up to you, it depends on how urgently you need to be up-to-date with some packages.选择取决于您,这取决于您需要更新某些软件包的紧迫程度。 Just start the installer to see what would happen, you can still enter n
to cancel the installation.只需启动安装程序看看会发生什么,您仍然可以输入n
取消安装。 I am going to take我要拿
conda update anaconda
without conda update conda
.没有conda update conda
。
And do not take conda update --all
unless you need the most recent update of some package, for example as a requirement for another package to be installed.并且不要使用conda update --all
除非您需要某个软件包的最新更新,例如作为安装另一个软件包的要求。 I ran into that when testing --all
, only after that, a new tensorflow add-on was suggested for download, but not after the other commands.我在测试--all
时遇到了这个问题,只有在那之后,才建议下载一个新的 tensorflow 插件,但不是在其他命令之后。 Normally, you will not need to be up to date on the point, therefore do not use --all
.通常,您不需要及时了解这一点,因此不要使用--all
。
On Mac, open a terminal and run the following two commands.在 Mac 上,打开终端并运行以下两个命令。
conda update conda
conda update anaconda
Make sure to run each command multiple times to update to the current version.确保多次运行每个命令以更新到当前版本。
Use:利用:
conda create -n py37 -c anaconda anaconda=5.3.1
conda env export -n py37 --file env.yaml
Locate the env.yaml file in C:\Windows\System32
and run the cmd as administrator:在C:\Windows\System32
中找到env.yaml文件并以管理员身份运行 cmd:
conda env update -n root -f env.yaml
Then it works!然后它起作用了!
The answer of the @InLaw was quite accurate. @InLaw的答案非常准确。 To complement, if you have python2
as default you can switch to python3
with an aliase. 作为补充,如果您默认使用python2
,则可以使用python2
切换到python3
。
Just type $ alias python=python3
只需输入$ alias python=python3
To undo, $ unalias python
撤消, $ unalias python
这只能更新 Python 实例:
conda update python
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.