`导入cv后`致命Python错误:PyThreadState_Get:没有当前线程`
我通过 sudo brew install opencv 安装了 OpenCV。
然后我将 PYTHONPATH
* 添加到我的 ~/.profile
中,如 brew info opencv
所说**。使用 env
我检查了路径是否已加载。
现在,每次我尝试导入cv
时,Python都会给出以下错误:致命Python错误:PyThreadState_Get:没有当前线程中止陷阱
。
我该怎么办?
*PYTHONPATH=/usr/local/lib/python2.7/site-packages/:
** 实际上,它指向文件夹 python2 .6
但 2.7 是我使用的 Python 版本,cv 2.2。支持它。
I installed OpenCV via sudo brew install opencv
.
Then I added PYTHONPATH
* to my ~/.profile
as brew info opencv
says**. With env
I checked that the path was loaded.
Now everytime I try to import cv
, Python gives following error: Fatal Python error: PyThreadState_Get: no current thread Abort trap
.
What should I do?
*PYTHONPATH=/usr/local/lib/python2.7/site-packages/:
** actually, it points to folder python2.6
but 2.7 is the Python version I use and cv 2.2. supports it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
cv 2.2 可能很好地支持它,但你不能混合这样的版本。你必须使用为 2.7 构建的版本和 2.7,为 2.6 构建的版本和 2.6
我似乎认为 cv 是一个依赖于 C 库的 python 库 - 在这种情况下,你不能像那样混合库。
如果您只有 2.6 版本,则需要针对 2.7 重新编译 cv。
也就是说,这种类型的致命错误表明 cv 库中存在错误,但是,如果您混合这样的版本,则结果是未定义的。 (它可能会偶然起作用,也可能会像您一样随机失败)。
cv 2.2 might well support it, but you MUST not mix versions like that. You must use the version built for 2.7 with 2.7, and the version built for 2.6 with 2.6
I seem to think that cv is a python library that depends on a C library - in that case, you can not mix the libraries like that.
cv will need to be re-compiled against 2.7 if you have only a 2.6 version of it.
That said, this type of Fatal Error suggests a bug in the cv library, however, if you're mixing versions like this, then the result is undefined. (It might work by chance, or it might fail randomly as it has for you).