[Python] OpenCV 4.1.2 - DLL Load Error: "The specified procedure could not be found" when...

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I followed this official OpenCV tutorial to build OpenCV 4.1.2 with GStreamer support on Windows 11 (64-bit). Build and install were successful, but importing cv2 fails with:

    ImportError: DLL load failed while importing cv2: The specified procedure could not be found.


    To isolate the problem, I:

    • Copied cv2.pyd into a clean test folder
    • Added all missing opencv_*.dll files (version 4120) into that same folder.
    • Wrote a test script that adds the DLL folders using os.add_dll_directory() and sets up the environment.
    • Used Process Monitor to trace loaded DLLs — some were missing, I added them all.
    • Verified with Dependencies.exe that cv2.pyd successfully loads all DLLs — no red entries.

    Yet, the same import error persists.

    script I used to test:

    import os, sys

    dll_dir = os.path.dirname(__file__)
    os.add_dll_directory(dll_dir)
    os.environ["PATH"] = dll_dir + os.pathsep + os.environ["PATH"]
    sys.path.insert(0, dll_dir)

    import cv2
    print(cv2.getBuildInformation())


    I also uploaded a screensht of dependencies.exe on cv2.pyd and LogFile.csv of procmon. Thanks in advance guys.

    Continue reading...

Compartilhe esta Página