[英]ImportError: No module named cv2 with Python 2.7
Here is what I have done 这就是我所做的
import cv2
import sys
sys.path.append('/usr/include/opencv')
im = cv2.imread("im1.png")
print type(im)
Then terminal gives me 然后终端给了我
File "m7.py", line 1, in <module>
import cv2
ImportError: No module named cv2
It seems to be installed here 它似乎安装在这里
pkg-config opencv --cflags
-I/usr/include/opencv
whereis opencv
opencv: /usr/include/opencv /usr/share/opencv
List of my files in build
我在
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
try adding the path before you try to import the cv modules. 尝试在导入cv模块之前尝试添加路径。
import sys
sys.path.append('/usr/include/opencv')
import cv2
Regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.