ImportError: dynamic module does not define module export function (PyInit_cv2)

前端 未结 2 1336
忘掉有多难
忘掉有多难 2021-01-13 01:39

When I try to import cv2 in IPython , I am getting this error-

ImportError: dynamic module does not define module export function (PyInit_cv2)

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-13 02:30

    In my case, I was using opencv library for python2 in python3.

    Check your PYTHONPATH by typing

    echo $PYTHONPATH

    and see there is correct path for python3.

    $ echo $PYTHONPATH
    :/usr/local/lib/python3.4/site-packages
    

    I define PYTHONPATH at the end of ~/.bashrc file. Modify it if you are loading python2's library.

    After source ~/.bashrc or restart terminal, check PYTHONPATH again

    It solves my problem.

提交回复
热议问题