这就是我所做的
import cv2
import sys
sys.path.append('/usr/include/opencv')
im = cv2.imread("im1.png")
print type(im)
然后终端给了我
File "m7.py", line 1, in <module>
import cv2
ImportError: No module named cv2
似乎安装在这里
pkg-config opencv --cflags
-I/usr/include/opencv
whereis opencv
opencv: /usr/include/opencv /usr/share/opencv
我在build
3rdparty CMakeCache.txt cmake_uninstall.cmake cvconfig.h include Makefile OpenCVConfig.cmake unix-install
apps CMakeFiles CPackConfig.cmake data junk modules OpenCVConfig-version.cmake version_string.tmp
bin cmake_install.cmake CPackSourceConfig.cmake doc lib opencv2 OpenCVModules.cmake
答案 0 :(得分:0)
尝试在尝试导入cv模块之前添加路径。
import sys
sys.path.append('/usr/include/opencv')
import cv2
此致