2

我已经安装了 Enthought Canopy Python 2.7.3 64 位,它有 OpenCV 2.4.2。当我import cv2收到以下错误时:

>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/Foo/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: @executable_path/../Python
  Referenced from: /Users/Foo/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cv2.so
  Reason: image not found

这篇文章建议解决方案是运行install_name_tool -change...,但我不知道传递它的选项,并且对动态库不够熟悉以理解手册页,所以我转向这里寻求帮助。

4

1 回答 1

0
install_name_tool -change @executable_path/../Python $HOME/Library/Enthought/Canopy_64bit/User/Python $HOME/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/cv2.so

感谢原作者,他还回答了问题链接中的完成线程。

于 2013-06-06T03:04:54.883 回答