我通过Cmake从Opencv 4.1的源代码构建并安装了它。我指定了Anaconda的python 3.7,用于构建python的OpenCV。 但是在安装OpenCV时,我不知道为什么使用的库是用户的库而不是Anaconda的库,如下所示:
-- Python 2:
-- Interpreter: (ver 2.7.15)
-- Libraries: NO
-- numpy: NO (Python wrappers can not be generated)
-- install path: -
--
-- Python 3:
-- Interpreter: /home/user/anaconda3/bin/python3.7m (ver 3.7.5)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.7m.so (ver 3.7.5)
-- numpy: /home/user/anaconda3/lib/python3.7/site-packages/numpy/core/include (ver )
-- install path: /home/user/anaconda3/lib/python3.7/site-packages/cv2/python-3.7
--
-- Python (for build): /home/user/anaconda3/bin/python3.7m
当我键入echo $ PYTHONPATH时,它显示: /home/user/anaconda3/lib/python3.7/site-packages: