[Python] Error import cv2 : ImportError: numpy.core.multiarray failed to import

Discussão em 'Python' iniciado por Stack, Fevereiro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to Ubuntu and I'm trying to use OpenCV module within Jupyter Notebook.

    I have a message error when I run:

    import cv2


    The message error is:

    ---------------------------------------------------------------------------
    RuntimeError Traceback (most recent call last)
    RuntimeError: module compiled against API version a but this version of numpy is 9

    ---------------------------------------------------------------------------
    ImportError Traceback (most recent call last)
    <ipython-input-20-72fbbcfe2587> in <module>()
    ----> 1 import cv2

    ImportError: numpy.core.multiarray failed to import


    I have read a few similar issues from other users on stackoverflow. This issue often comes from a wrong numpy version. I checked and I use numpy 1.9.2:

    numpy.version.version
    Out[22]:'1.9.2'


    From what I understand from other posts, versions 1.8 and above should be enough. Has anyone any idea of what might be wrong?

    For information, my version of Python/Anaconda is

    print sys.version
    2.7.10 |Anaconda 2.3.0 (64-bit)| (default, Sep 15 2015, 14:50:01)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]


    Thanks for any help on this matter!

    Continue reading...

Compartilhe esta Página