[英]ImportError: dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: _PyCObject_Type
This is how I installed opencv3 on my machine.这就是我在我的机器上安装 opencv3 的方式。 I had python 3.6 installed in my system.
我的系统中安装了 python 3.6。 I ran,
我跑了,
$ brew install opencv3 --with-contrib --with-python3 --HEAD
Then changed the name of opencv3 package in the 3.6 site package.然后在3.6站点包中更改了opencv3包的名称。
$ cd /usr/local/opt/opencv3/lib/python3.6/site-packages/
$ mv cv2.cpython-35m-darwin.so cv2.so
And then created .pth file.然后创建 .pth 文件。
$ echo /usr/local/opt/opencv3/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth
Now when I get on the python 3 REPL and call现在,当我使用 python 3 REPL 并调用
import cv2
This is the error that I get.这是我得到的错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: _PyCObject_Type
Referenced from: /usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so
Expected in: flat namespace
in /usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so
I want my python 3 interpreter to look into the python 3.6 site packages for cv2 and I can't get it to do that.我想让我的 python 3 解释器查看 cv2 的 python 3.6 站点包,但我无法做到这一点。 Any help appreciated.
任何帮助表示赞赏。
I removed all opencv3 folders and removed the opencv package in python environment and then installed opencv again.我删除了所有opencv3文件夹并删除了python环境中的opencv包,然后再次安装了opencv。 It's working for me now.
它现在对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.