在 conda yml 中用 CMAKE_ARGS 指定 opencv
Specify opencv with CMAKE_ARGS in conda yml
如何指定 conda(在 environment.yml
中)以在指定 CMAKE_ARGS
.
时使用 pip 安装 opencv-contrib-python
基本上,我如何在 environment.yml
文件
中为 运行 这个命令指定 conda
CMAKE_ARGS="-DOPENCV_ENABLE_NONFREE=ON" pip install --no-binary=opencv-contrib-python opencv-contrib-python
如果我通过 conda env export > environment.yml
导出环境,它只是像这样指定 opencv 的版本
name: test
channels:
- conda-forge
- pkgs/main
- defaults
dependencies:
- Bunch of conda dependencies
- pip:
- opencv-contrib-python==4.5.1.48
prefix: /home/an/miniconda3/envs/test
虽然 Conda v4.9 did add an option 通过 YAML 管理活动环境中的环境变量,但在环境创建期间不会设置这些变量。因此,无法在通过 YAML 创建环境时设置 CMAKE_ARGS
。
pip install
命令的其余部分可以添加:
name: test
channels:
- conda-forge
- defaults # note that 'main' is a subset of defaults
dependencies:
# - Bunch of conda dependencies
- pip
- pip:
- --no-binary=opencv-contrib-python
- opencv-contrib-python
并在调用时设置 CMAKE_ARGS
:
CMAKE_ARGS="-DOPENCV_ENABLE_NONFREE=ON" conda env create -f environment.yml
如何指定 conda(在 environment.yml
中)以在指定 CMAKE_ARGS
.
opencv-contrib-python
基本上,我如何在 environment.yml
文件
CMAKE_ARGS="-DOPENCV_ENABLE_NONFREE=ON" pip install --no-binary=opencv-contrib-python opencv-contrib-python
如果我通过 conda env export > environment.yml
导出环境,它只是像这样指定 opencv 的版本
name: test
channels:
- conda-forge
- pkgs/main
- defaults
dependencies:
- Bunch of conda dependencies
- pip:
- opencv-contrib-python==4.5.1.48
prefix: /home/an/miniconda3/envs/test
虽然 Conda v4.9 did add an option 通过 YAML 管理活动环境中的环境变量,但在环境创建期间不会设置这些变量。因此,无法在通过 YAML 创建环境时设置 CMAKE_ARGS
。
pip install
命令的其余部分可以添加:
name: test
channels:
- conda-forge
- defaults # note that 'main' is a subset of defaults
dependencies:
# - Bunch of conda dependencies
- pip
- pip:
- --no-binary=opencv-contrib-python
- opencv-contrib-python
并在调用时设置 CMAKE_ARGS
:
CMAKE_ARGS="-DOPENCV_ENABLE_NONFREE=ON" conda env create -f environment.yml