如何更新Anaconda? [英] How do I update Anaconda?

查看:1629
本文介绍了如何更新Anaconda?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上安装了Anaconda,我想对其进行更新.在Navigator中,我可以看到有几个可以更新的单独程序包,还有一个anaconda程序包,该程序包有时具有版本号,有时说custom.我该如何进行?

I have Anaconda installed on my computer and I'd like to update it. 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. How do I proceed?

推荐答案

root是主环境的旧名称(conda 4.4之前的名称);在conda 4.4之后,它被重命名为base.

root is the old (pre-conda 4.4) name for the main environment; after conda 4.4, it was renamed to be base. source

95%的人实际想要什么

在大多数情况下,说要更新Anaconda时要做的是执行命令:

What 95% of people actually want

In most cases what you want to do when you say that you want to update Anaconda is to execute the command:

conda update --all

(但是conda update -n base conda应该先于 ,因此您已安装了最新的conda版本)

(But this should be preceeded by conda update -n base conda so you have the latest conda version installed)

这会将当前环境中的所有软件包更新到最新版本-较小的字样是它可能会使用某些软件包的较旧版本来满足依赖关系约束(通常不需要,并且在需要时打包计划求解程序将尽最大努力使影响最小化是必要的.

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).

这需要从命令行执行,并且到达那里的最好方法是从Anaconda Navigator,然后是"Environments".标签,然后点击base环境旁边的三角形,选择打开终端":

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":

此操作将仅更新一个选定的环境(在这种情况下为base环境).如果您要更新其他环境,则可以重复上述过程,但请先单击该环境.选择该选项后,右侧会出现一个三角形标记(请参见上图,第3步).或从命令行中,您可以提供环境名称(-n envname)或路径(-p /path/to/env),例如,从上面的屏幕截图中更新您的dspyr环境:

This operation will only update the one selected environment (in this case, the base environment). 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). 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:

conda update -n dspyr --all

更新单个软件包

如果您只对更新单个软件包感兴趣,则只需在导航器中单击蓝色箭头或蓝色版本号,例如在上面的屏幕截图中的astroidastropy中,这将标记这些软件包以进行升级.完成后,您需要点击应用"按钮:

Update individual packages

If you are only interested in updating an individual package then simply click on the blue arrow or blue version number in Navigator, e.g. for astroid or astropy in the screenshot above, and this will tag those packages for an upgrade. When you are done you need to click the "Apply" button:

或从命令行:

conda update astroid astropy

仅更新标准Anaconda发行版中的软件包

如果您不关心软件包版本,而只想标准Anaconda发行版中所有软件包的最新集合,只要它们可以一起使用" ,那么您应该看看这个要点.

在大多数情况下,更新软件包列表中的Anaconda软件包将产生令人惊讶的结果:您实际上可以降级许多软件包(实际上,如果它指示版本为custom,则可能会出现这种情况) .上面的要点提供了详细信息.

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). The gist above provides details.

您的base环境可能不是尝试管理一组确切软件包的好地方:它将成为一个动态的工作空间,其中安装了新软件包并随机更新了软件包.如果您需要一组确切的软件包,请创建一个conda环境来保存它们.多亏了conda程序包缓存和文件链接的使用方式,通常i)快速,并且ii)占用很少的额外磁盘空间.例如

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. If you need an exact set of packages then create a conda environment to hold them. 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. E.g.

conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk

conda文档中有更多详细信息和示例.

The conda documentation has more details and examples.

这些都无助于更新通过pip从PyPI安装的软件包或使用python setup.py install安装的任何软件包. conda list将为您提供有关环境中基于pip的Python包的一些提示,但对其进行更新不会做任何特别的事情.

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. 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.

几乎完全相同,但是如果base环境是由其他人安装的(例如/opt/anaconda/latest),则可能无法更新.如果您无法更新正在使用的环境,则应该可以克隆然后更新:

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). 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

这篇关于如何更新Anaconda?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆