我用C++應用程序中的單個函數調用單個python模塊。我得到一個堆棧跟蹤。我將它隔離到python模塊中的「import h5py」行。如果我在解釋器中運行這個模塊和函數,一切都很好。此外,所有其他進口的工作。如果我刪除「import h5py」並註釋使用它的代碼,然後加載模塊並從C++調用函數,一切正常。PyImport_Import段錯誤
也做了一個test.py,果然如果我做這個導入並加載模塊在C++中,它有相同的結果。
有沒有人見過這樣的事情?有沒有辦法解決它,因爲我真的需要在我的python模塊中使用h5py,並需要從我們的C++應用程序調用模塊。
Killing process on sync signal: 6, Aborted
BEGIN stack trace
0: /lib64/libpthread.so.0() [0x346620f500]
1: /lib64/libc.so.6(gsignal+0x35) [0x3465e328a5]
2: /lib64/libc.so.6(abort+0x175) [0x3465e34085]
3: /opt/gs/lib/libhdf5.so.8(H5check_version+0x13d) [0x2b8c62611e5d]
4: /opt/gs/epd-7.3/lib/python2.7/site-packages/h5py/h5f.so(inith5f+0x19c1) [0x2b8c8df11481]
5: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(_PyImport_LoadDynamicModule+0xc2) [0x2b8c61c78312]
6: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xed290) [0x2b8c61c76290]
7: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xed531) [0x2b8c61c76531]
8: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyImport_ImportModuleLevel+0x2be) [0x2b8c61c7756e]
9: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xd447d) [0x2b8c61c5d47d]
10: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyObject_Call+0x68) [0x2b8c61bcef28]
11: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyEval_CallObjectWithKeywords+0x56) [0x2b8c61c5d9a6]
12: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x28b8) [0x2b8c61c60f08]
13: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x8d2) [0x2b8c61c65c12]
14: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x32) [0x2b8c61c65c62]
15: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(PyImport_ExecCodeModuleEx+0xc2) [0x2b8c61c74c02]
16: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xec1ce) [0x2b8c61c751ce]
17: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xeda8d) [0x2b8c61c76a8d]
18: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xed290) [0x2b8c61c76290]
19: /opt/gs/epd-7.3/lib/libpython2.7.so.1.0(+0xed764) [0x2b8c61c76764]
END stack trace
它看起來像'H5check_version()'導致中止。在這種情況下,文檔[此處](https://support.hdfgroup.org/HDF5/doc1.6/RM_H5.html#Library-VersCheck)解釋了該錯誤。 – Gribouillis
這確實是C++使用h5版本8和python試圖導入h5版本7.試圖找出與鏈接的解決方案。 – lr100