Ask Your Question
1

cannot use opencv3 with python2 in windows7. cv2.pyd is strange.

asked 2015-10-02 01:10:26 -0600

gelgel gravatar image

python2.7.9 on win 32. numpy,matplotlib.

cmake.

1.configure the sorce file.checked visual studio 2013(visual studio12).
2.get the red screen and input OPENCV_EXTRA_MODULES_PATH to C:/python27/opencv_contrib-master/modules
3.again configure
4.generate and cmake end. now my build file has 7.68MB.

build

1.open the OpenCV.sln
2.build mode change to Release.
3.build "ALL_BUILD" build 99 nothing error.
4.build "INSTALL" build 3 error 97. this time my build file has 3.91GB.

check Python27/Lib/site-packages

site-packages has cv2.pyd but this size 1.61MB.
of course , cannot import cv2.
ImportError: DLL load failed......
Among these processes , do you think the cause that does not work there is what ?
PATH? cmake? build?
and teach me Required settings.
please help me.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
2

answered 2015-10-02 01:23:06 -0600

berak gravatar image

"site-packages has cv2.pyd but this size 1.61MB. " - this means, you built dynamic libs for opencv, and now cv2.pyd is dependant on finding the opencv dlls at runtime. please adjust your PATH env. variable, so it points to the folder with the opencv dlls.

to avoid this problem, choose BUILD_SHARED_LIBS=OFF in cmake, and rebuild. this should result in a much larger (>10mb) cv2.pyd, which no more depends on opencv dlls

edit flag offensive delete link more

Comments

Thank you berak! I tried to as your advice. After build "INSTALL", cv2.pyd size is 29.2MB. and successful import cv2. very thank you! but I have a question. when build "INSTALL" , output was "build 3, error 97". what errors mean? If I neglect it , is there anything wrong?

gelgel gravatar imagegelgel ( 2015-10-02 03:39:22 -0600 )edit

have not seen that error. can you paste a few more lines around it ?

berak gravatar imageberak ( 2015-10-02 03:42:03 -0600 )edit
1

Sorry my misjudgment. 97 was Update unnecessary. error was 0. again, thank you for answer .

gelgel gravatar imagegelgel ( 2015-10-02 04:11:35 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-02 01:10:26 -0600

Seen: 507 times

Last updated: Oct 02 '15