renatoGarcia/opencv-swig

undefined symbol: PyInstanceMethos_New when run Hello world example

suzhenxzhong opened this issue · 1 comments

Hi, I met a import error when run the hello_world sample. The message shows like this:

Traceback (most recent call last):
File "opencvcpython_test.py", line 1, in
import my_lib
File "/home/su/Downloads/opencv-swig-master/hello_world/build/my_lib.py", line 15, in
import _my_lib
ImportError: /home/su/Downloads/opencv-swig-master/hello_world/build/_my_lib.so: undefined symbol: PyInstanceMethod_New

Noted:
This is the opencvcpython_test.py file contex:
import my_lib
import numpy as np
import cv2

p0 = my_lib.Point(13, 17)
my_lib.moveTo(p0)

cv_img = my_lib.getImage()
np_arr = cv2.blur(np.asarray(cv_img), (3, 3))

cv_img2 = my_lib.Mat3b.from_array(np_arr)

Hi @suzhenxzhong,
This looks like you are having some problems loading the Python3 lib.
How did you compile the code? Have you successfully compiled and run the hello_world example? You did it without any code change and using CMake to generate the makefiles?