使用pycocotools时出现"undefined symbol: _Py_ZeroStruct"
程序员文章站
2022-05-26 23:40:52
...
问题描述:
运行
from pycocotools.coco import COCO
报错:
ImportError: /home/elijha/PycharmProjects/LinkinNet/cocoapi-master/PythonAPI/pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct
出错原因
*的回答:
This error message is typical when there’s a version mismatch in Python modules. It could something like cython_bbox.so was compiled and linked against Python 2.7 and CNTK was compiled against Python 3.5. It’s hard to say exactly what the reason is but you can try to do make inside a python environment that matches your CNTK version and see if that works.
检查后发现,我把Cython安装在了python2.7的环境内,而且make也是在此环境下进行的。而import的环境是python3.5,因此出错。
解决方法
- 在python2.7下卸载Cython。(这一步其实可以不做,但是因为我从来不用这个环境,就也卸载了。)
- 进入python3.5,执行
pip install Cython
- 重进进入pycocotools文件夹,执行make。(即用python3重新运行pycocotools下的setup.py进行安装。)
- 重新运行
from pycocotools.coco import COCO
,正确。
上一篇: pycurl.so: undefined symbol 解决方法
下一篇: MySQL5.6安装
推荐阅读
-
使用g++编译tf_ops出现undefined symbol: _ZN10tensorflow8internal21CheckOpMessageBuilder9NewStringEv
-
【】使用cURL库时出现Fatal error: Call to undefined function curl_init()
-
【】使用cURL库时出现Fatal error: Call to undefined function curl_init()
-
ImportError: No module named pycocotools.coco,pycocotools/_mask.so: undefined symbol: _Py_ZeroStruct
-
使用pycocotools时出现"undefined symbol: _Py_ZeroStruct"
-
使用pycocotools时出现"undefined symbol: _Py_ZeroStruct"
-
使用meld或beyondcompare时出现cairo的错误: undefined symbol: cairo_tee_surface_index
-
Vue中使用PubSub-js进行组件间通信时出现‘publish‘ of undefined异常解决办法