python - 是否应该将 conda 或 conda-forge 用于 Python 环境?

标签 python anaconda conda

Condaconda-forge 都是 Python 包管理器。当两个存储库中都存在一个包时,什么是合适的选择?例如,Django 可以安装任何一个,但两者之间的区别在于几个依赖项(conda-forge 有更多)。没有对这些差异的解释,甚至没有一个简单的 README。

应该使用哪一个? conda 还是 conda 锻造?有关系吗?

最佳答案

简短的回答是,根据我的一般经验,你使用哪个并不重要。

长答案:

所以 conda-forge 是一个可以安装软件包的附加 channel 。从这个意义上说,它并不比默认 channel 或人们发布包裹的其他数百个(数千个?) channel 中的任何一个更特别。如果您在 https://anaconda.org 注册,您可以添加自己的 channel 并上传您自己的 Conda 包。

在这里,我们需要区分,跨平台包管理器 condaconda- forge,包 channel 。 conda 软件的主要开发者 Anaconda Inc.(前身为 Continuum IO)也维护一个单独的包 channel ,这是您在不输入 conda install packagename 时的默认设置更改任何选项。

可以通过三种方式更改 channel 选项。前两个在您每次安装软件包时完成,最后一个是持久的。第一个是每次安装包时指定一个 channel :

conda install -c some-channel packagename

当然,包必须存在于该 channel 上。这种方式将从 some-channel 安装 packagename 及其所有依赖项。或者,您可以指定:

conda install some-channel::packagename

包仍然必须存在于 some-channel 上,但现在,只有 packagename 将从 some-channel 中提取。满足依赖关系所需的任何其他包都将从您的默认 channel 列表中搜索。

要查看您的 channel 配置,您可以编写:

conda config --show channels

您可以使用 conda config 控制搜索 channel 的顺序。你可以写:

conda config --add channels some-channel

将 channel some-channel 添加到 channels 配置列表的顶部。这赋予 some-channel 最高优先级。优先级决定 (in part) 当多个 channel 具有特定包时选择哪个 channel 。要将 channel 添加到列表末尾并为其赋予最低优先级,请键入

conda config --append channels some-channel

如果你想删除你添加的 channel ,你可以写

conda config --remove channels some-channel

conda config -h

更多选项。

综上所述,使用 conda-forge channel 而不是 Anaconda 维护的 defaults channel 有四个主要原因:

  1. conda-forge 可能上的包比 defaults channel 上的包更新
  2. conda-forge channel 上的某些包在 defaults
  3. 中不可用
  4. 您更愿意使用诸如 openblas 之类的依赖项(来自 conda-forge)而不是 mkl(来自 defaults)。
  5. 如果您要安装需要编译库的软件包(例如,C 扩展或 C 库的包装器),如果您安装所有软件包,它可能会减少不兼容的可能性由于基础 C 库的二进制兼容性,在单 channel 环境中(但此建议可能已过时/将来会更改)。如需引用,请参阅 the Conda Forge post on mixing channels .

关于python - 是否应该将 conda 或 conda-forge 用于 Python 环境?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39857289/

相关文章:

python - Conda 在哪里保存与 Conda 环境相关的编译库?

python - 允许在 conda env 中使用系统 python?

python - 数据插入错误 : invalid literal for int() with base 10

python - 发现 CSV 映射强制到 Unicode : need string or buffer, 列表

python - 类型错误 : bad operand type for unary ~: 'float' while groupby and apply a function

python - 从分割图像中获取边界

python - Anaconda ipython-notebook 获取 "UnicodeDecodeError: ' ascii' 编解码器无法解码位置 1 中的字节 0xb0"

tensorflow - 由于 ImportError : cannot import name 'keras_export' from 'tensorflow.python.util.tf_export' 无法运行 anpose

python - 使用 conda 将 python 更新到特定版本

postgresql - Conda 环境中的 Postgres (Ubuntu 14.04)