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

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

问题描述

我的电脑上安装了 Anaconda,我想更新它.在 Navigator 中,我可以看到有几个单独的包可以更新,还有一个 anaconda 包,它有时有一个版本号,有时说 custom.我该如何继续?

解决方案

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

此操作只会更新一个选定的环境(在本例中为base 环境).如果您有其他想要更新的环境,可以重复上述过程,但首先单击环境.当它被选中时,右侧会出现一个三角形标记(见上图,步骤 3).或者从命令行您可以提供环境名称 (-n envname) 或路径 (-p/path/to/env),例如更新您的 dspyr 上面截图中的环境:

conda update -n dspyr --all

更新单个包

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

或者从命令行:

conda 更新 astroid astropy

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

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

为什么更新 Anaconda 包几乎总是一个坏主意

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

利用 conda 环境

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

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

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

pip、PyPI 和设置工具?

这些都不会帮助更新通过 pip 从 PyPI 安装的软件包或使用 python setup.py install 安装的任何软件包.conda list 会给你一些关于你在环境中拥有的基于 pip 的 Python 包的提示,但它不会做任何特殊的事情来更新它们.

Anaconda 或 Anaconda Enterprise 的商业用途

这几乎是完全相同的故事,除了您可能无法更新 base 环境,如果它是由其他人安装的(比如 /opt/anaconda/最新).如果您无法更新您正在使用的环境,您应该能够克隆然后更新:

conda create -n myenv --clone baseconda update -n myenv --all

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 is the old (pre-conda 4.4) name for the main environment; after conda 4.4, it was renamed to be base. source

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

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

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

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

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:

Or from the command line:

conda update astroid astropy

Updating just the packages in the standard Anaconda Distribution

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.

Why updating the Anaconda package is almost always a bad idea

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.

Leverage conda environments

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

The conda documentation has more details and examples.

pip, PyPI, and setuptools?

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.

Commercial use of Anaconda or Anaconda Enterprise

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天全站免登陆