問題描述
我使用 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
為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
文件中(docs):
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
- numpy=1.13.3 # pin version for conda
- pip:
# works for regular pip packages
- docx
- gooey
- matplotlib==2.0.0 # pin version for pip
# and for wheels
- http://www.lfd.uci.edu/~gohlke/pythonlibs/bofhrmxk/opencv_python-3.1.0-cp35-none-win_amd64.whl
它也適用于同一目錄中的 .whl
文件(請參閱 Dengar 的答案)以及常見的 pip 包.
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 相結合的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!