将conda environment.yml与pip requrements.txt相结合 [英] Combining conda environment.yml with pip requrements.txt

查看:220
本文介绍了将conda environment.yml与pip requrements.txt相结合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用conda环境,还需要一些pip包,例如来自〜gohlke 的预编译轮。

I work with conda environments and need some pip packages as well, e.g. pre-compiled wheels from ~gohlke.

目前我有两个文件: environment.yml for conda with:

At the moment I have two files: environment.yml for conda with:

# run: conda env create --file environment.yml
name: test-env
dependencies:
- python>=3.5
- anaconda

requirements.txt 安全环境:

# run: pip install -i requirements.txt
http://www.lfd.uci.edu/~gohlke/pythonlibs/bofhrmxk/opencv_python-3.1.0-cp35-none-win_amd64.whl

有可能将它们组合在一个文件(for conda)中吗?

Is there a possibility to combine them in one file (for conda)?

推荐答案

啊,我找到了解决方案:可以在 environment.yml 中包含额外的点依赖关系,如下所示:

Ah, I found the solution: I can include extra pip dependencies in the environment.yml for conda like this:

# run: conda env create --file environment.yml
name: test-env
dependencies:
- python>=3.5
- anaconda
- pip
- pip:
  - http://www.lfd.uci.edu/~gohlke/pythonlibs/bofhrmxk/opencv_python-3.1.0-cp35-none-win_amd64.whl

太好了但是为什么在这个公报中没有提到 docs

That is great! But why is it not mentioned in the conda docs?

编辑:

  • It is mentioned in the docs now.
  • It also works for .whl files in the same directory (see Dengar's answer) as well as with common pip packages.

这篇关于将conda environment.yml与pip requrements.txt相结合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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