opencv / cv2 / opencv-python名称不匹配,如何说服pip不要查找已通过conda安装的软件包?

时间:2019-06-04 09:44:06

标签: python opencv pip anaconda

python opencv绑定包含在conda-forge上名为opencv的软件包中,或包含在pypi上的opencv-python的软件包中。在conda-forge上安装opencv将使cv2模块可用。但是,在通过conda安装此文件并根据Opencv pip install打包软件包后,pip install找不到现有的软件包。根据在setup.py中调用该程序包的方式,它要么搜索程序包但找不到它,要么找到它并与conda版本一起安装。

$ conda list | grep opencv
opencv                    4.1.0            py37h5517eff_4    conda-forge

如果setup.py中的名称是opencv,它将搜索(即使已经有opencv)但找不到:

$ pip install .
Processing /home/gholl/checkouts/fogpy
Requirement already satisfied: numpy>=1.16 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (1.16.2)
Requirement already satisfied: scipy>=1.2 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (1.2.1)
Requirement already satisfied: matplotlib>=1.4.2 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (3.0.3)
Requirement already satisfied: pyorbital>=1.5.0 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (1.5.0)
Requirement already satisfied: trollimage>=1.8.0 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (1.8.0)
Requirement already satisfied: satpy>=0.15 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (0.15.1+38.gc7161c08)
Requirement already satisfied: pyresample>=1.11 in /media/nas/x21324/miniconda3/envs/py37d/lib/python3.7/site-packages (from fogpy==1.1.3+dev92.gb109242.temp) (1.11.2)
Collecting opencv>=4.1 (from fogpy==1.1.3+dev92.gb109242.temp)
  Could not find a version that satisfies the requirement opencv>=4.1 (from fogpy==1.1.3+dev92.gb109242.temp) (from versions: )
No matching distribution found for opencv>=4.1 (from fogpy==1.1.3+dev92.gb109242.temp)

如果setup.py中的名称为opencv-python,它将在第一个名称旁边安装第二个opencv,并且导入cv2模块将导致未定义的符号错误。

我如何说服pip识别opencv的conda安装?

0 个答案:

没有答案