ImportError: DLL load failed while importing cv2: The specified module could not be found | 您所在的位置:网站首页 › opencv450配置 › ImportError: DLL load failed while importing cv2: The specified module could not be found |
I’m hoping someone can guide me resolve this error on my setup. Note that I did not encounter this error on my first try of building the code (used OPENCV_ENABLE_NONFREE). After a while (couple of days), I then tried to include CUDA but this error starts to appear: Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 Traceback (most recent call last): File "", line 1, in File "C:\DevHome\Program\OpenCV450\build\python_loader\cv2\__init__.py", line 96, in bootstrap() File "C:\DevHome\Program\OpenCV450\build\python_loader\cv2\__init__.py", line 86, in bootstrap import cv2 ImportError: DLL load failed while importing cv2: The specified module could not be found.After several days of trying and searching the net, I’m still unable to find a solution. I did try reinstalling Python (still 3.8.6) and changed OpenCV version to 4.5.0 (from 4.5.1) but still no luck. Perhaps a Windows or driver update caused the problem? My recent finding is that when I don’t include OPENCV_ENABLE_NONFREE, the error is gone (but why was I successful before?) Here are the details of my setup: – CMake Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042. Detected processor: AMD64 libjpeg-turbo: VERSION = 2.0.5, BUILD = opencv-4.5.0-libjpeg-turbo Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources OpenJPEG: VERSION = 2.3.1, BUILD = opencv-4.5.0-openjp2-2.3.1 OpenJPEG libraries will be built from sources: libopenjp2 (version "2.3.1") found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold] at: C:/DevHome/Program/OpenCV450/build/3rdparty/ippicv/ippicv_win/icv found Intel IPP Integration Wrappers sources: 2020.0.0 at: C:/DevHome/Program/OpenCV450/build/3rdparty/ippicv/ippicv_win/iw Could not find OpenBLAS include. Turning OpenBLAS_FOUND off Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off Could NOT find BLAS (missing: BLAS_LIBRARIES) Could NOT find LAPACK (missing: LAPACK_LIBRARIES) Reason given by package: LAPACK could not be found because dependency BLAS could not be found. VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file OpenCV Python: during development append to PYTHONPATH: C:/DevHome/Program/OpenCV450/build/python_loader Module opencv_alphamat disabled because the following dependencies are not found: Eigen Caffe: NO Protobuf: NO Glog: NO freetype2: NO harfbuzz: NO Julia not found. Not compiling Julia Bindings. Module opencv_ovis disabled because OGRE3D was not found No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake. Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components. Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags Allocator metrics storage type: 'long long' Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/DevHome/Program/OpenCV450/source/opencv-4.5.0/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake opencv_dnn: filter out cuda4dnn source code General configuration for OpenCV 4.5.0 ===================================== Version control: unknown Extra modules: Location (extra): C:/DevHome/Program/OpenCV450/source/opencv_contrib-4.5.0/modules Version control (extra): unknown Platform: Timestamp: 2021-01-14T11:59:53Z Host: Windows 10.0.19042 AMD64 CMake: 3.19.2 CMake generator: Visual Studio 16 2019 CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe MSVC: 1928 CPU/HW features: Baseline: SSE SSE2 SSE3 requested: SSE3 Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX SSE4_1 (17 files): + SSSE3 SSE4_1 SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX512_SKX (7 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX C/C++: Built as dynamic libs?: YES C++ standard: 11 C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe (ver 19.28.29336.0) C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MD /O2 /Ob2 /DNDEBUG /Zi C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MDd /Zi /Ob0 /Od /RTC1 C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MD /O2 /Ob2 /DNDEBUG /Zi C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MDd /Zi /Ob0 /Od /RTC1 Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug Linker flags (Debug): /machine:x64 /debug /INCREMENTAL ccache: NO Precompiled headers: YES Extra dependencies: 3rdparty dependencies: OpenCV modules: To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hdf hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto Disabled: world Disabled by dependency: - Unavailable: alphamat cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv freetype java js julia matlab ovis python2 sfm viz Applications: tests perf_tests apps Documentation: NO Non-free algorithms: YES Windows RT support: NO GUI: Win32 UI: YES VTK support: NO Media I/O: ZLib: build (ver 1.2.11) JPEG: build-libjpeg-turbo (ver 2.0.5-62) WEBP: build (ver encoder: 0x020f) PNG: build (ver 1.6.37) TIFF: build (ver 42 - 4.0.10) JPEG 2000: build (ver 2.3.1) OpenEXR: build (ver 2.3.0) HDR: YES SUNRASTER: YES PXM: YES PFM: YES Video I/O: DC1394: NO FFMPEG: YES (prebuilt binaries) avcodec: YES (58.91.100) avformat: YES (58.45.100) avutil: YES (56.51.100) swscale: YES (5.7.100) avresample: YES (4.0.0) GStreamer: NO DirectShow: YES Media Foundation: YES DXVA: YES Parallel framework: Concurrency Trace: YES (with Intel ITT) Other third-party libraries: Intel IPP: 2020.0.0 Gold [2020.0.0] at: C:/DevHome/Program/OpenCV450/build/3rdparty/ippicv/ippicv_win/icv Intel IPP IW: sources (2020.0.0) at: C:/DevHome/Program/OpenCV450/build/3rdparty/ippicv/ippicv_win/iw Lapack: NO Eigen: NO Custom HAL: NO Protobuf: build (3.5.1) OpenCL: YES (NVD3D11) Include path: C:/DevHome/Program/OpenCV450/source/opencv-4.5.0/3rdparty/include/opencl/1.2 Link libraries: Dynamic load Python 3: Interpreter: C:/DevHome/Program/Python/Python38/python.exe (ver 3.8.6) Libraries: optimized C:/DevHome/Program/Python/Python38/libs/python38.lib debug C:/DevHome/Program/Python/Python38/libs/python38_d.lib (ver 3.8.6) numpy: C:/DevHome/Program/Python/Python38/lib/site-packages/numpy/core/include (ver 1.19.3) install path: C:/DevHome/Program/Python/Python38/Lib/site-packages/cv2/python-3.8 Python (for build): C:/DevHome/Program/Python/Python38/python.exe Java: ant: NO JNI: C:/Program Files/Java/jdk-11.0.9/include C:/Program Files/Java/jdk-11.0.9/include/win32 C:/Program Files/Java/jdk-11.0.9/include Java wrappers: NO Java tests: NO Install to: C:/DevHome/Program/OpenCV450/build/install ----------------------------------------------------------------- Configuring done– Hardware ![]() Let me know if you need other details. Note that VS 2019 compilation and installation are both successful. Any kind of help will be highly appreciated. |
CopyRight 2018-2019 实验室设备网 版权所有 |