结合conda environment.yml和pip requirements.txt [英] Combining conda environment.yml with pip requirements.txt

查看:182
本文介绍了结合conda environment.yml和pip requirements.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用于conda,

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表示pip,可在激活以上conda环境后使用:

and requirements.txt for pip which can be used after activating above conda environment:

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

是否可以将它们合并到一个文件中(用于conda)?

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

推荐答案

Pip依赖项可以这样包含在environment.yml文件中(

Pip dependencies can be included in the environment.yml file like this (docs):

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

它也适用于同一目录中的.whl文件(请参见 Dengar的答案)以及常见的提示包.

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 requirements.txt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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