简体   繁体   English

导入错误:dlopen(/usr/local/opt/opencv3/lib/python2.7/site-packages/cv2.so, 2):找不到符号:_PyCObject_Type

[英]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.

相关问题 mod_wsgi错误:ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2.so,2):找不到符号:_iconv - mod_wsgi Error: ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2.so, 2): Symbol not found: _iconv ImportError:dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so - ImportError: dlopen(/usr/local/lib/python2.7/site-packages/_geoslib.so 使用张量流时出现ImportError:dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so,2) - getting ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2) when working with tensor flow Python OSX - /usr/local/lib/python2.7/site-packages/easysnmp/interface.so中的平面命名空间 - Python OSX - flat namespace in /usr/local/lib/python2.7/site-packages/easysnmp/interface.so 如何在Linux下的/usr/local/lib/python2.7/site-packages下安装Pip - how to Install Pip under /usr/local/lib/python2.7/site-packages in Linux Python:ImportError:/usr/local/lib/python2.7/lib-dynload/_io.so:undefined symbol:PyUnicodeUCS2_Replace - Python: ImportError: /usr/local/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyUnicodeUCS2_Replace 找不到:/lib/python2.7/site-packages/tensorflow/tensorboard/lib/svg/summary-icon.sv - Not found : /lib/python2.7/site-packages/tensorflow/tensorboard/lib/svg/summary-icon.sv 如何忽略〜/ .local / lib / python2.7 / site-packages中的python模块? - How to ignore python module in ~/.local/lib/python2.7/site-packages? 安装python settuptools时发生错误-没有这样的文件或目录:&#39;/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth&#39; - Error when installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth' 安装djangorestframework时出现错误-权限被拒绝:&#39;/ usr / lib / python2.7 / site-packages / djangorestframework-3.6.3.dist-info&#39; - Getting Error while installing djangorestframework - Permission denied: '/usr/lib/python2.7/site-packages/djangorestframework-3.6.3.dist-info'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM