我在尝试导入使用 swig 的 python 库时遇到“错误的 ELF class”错误
I get an “wrong ELF class” error trying to import a python library that uses swig
我一直在尝试导入一个名为 dwave tabu 的 python 库,它使用 swig,但我遇到了一些问题。在 python3 中导入包时,我得到了这个结果:
>>>import tabu
Traceback (most recent call last):
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 914, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chip/.local/lib/python3.5/site-packages/tabu/__init__.py", line 17, in <module>
from tabu.tabu_search import TabuSearch
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 17, in <module>
_tabu_search = swig_import_helper()
File "/home/chip/.local/lib/python3.5/site-packages/tabu/tabu_search.py", line 16, in swig_import_helper
return importlib.import_module('_tabu_search')
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_tabu_search'
我怀疑错误与swig有关,但我不确定如何解决它。另外,在 32 位安装上,似乎是针对 64 位 linux 编译的二进制文件引起的错误,但我不知道如何解决该问题。任何帮助将不胜感激。
谢谢
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
此错误表示:您正在尝试将 64 位 _tabu_search.so
库加载到 32 位进程中。您必须使用 64 位 python
,或者安装 32 位版本的 tabu_search
软件包。
I suspect that the error has something to do with swig
不,SWIG
与您的问题几乎无关。
我一直在尝试导入一个名为 dwave tabu 的 python 库,它使用 swig,但我遇到了一些问题。在 python3 中导入包时,我得到了这个结果:
>>>import tabu
Traceback (most recent call last):
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 914, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/chip/.local/lib/python3.5/site-packages/tabu/__init__.py", line 17, in <module>
from tabu.tabu_search import TabuSearch
File "/home/chip/.local/lib/python3.5/site- packages/tabu/tabu_search.py", line 17, in <module>
_tabu_search = swig_import_helper()
File "/home/chip/.local/lib/python3.5/site-packages/tabu/tabu_search.py", line 16, in swig_import_helper
return importlib.import_module('_tabu_search')
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_tabu_search'
我怀疑错误与swig有关,但我不确定如何解决它。另外,在 32 位安装上,似乎是针对 64 位 linux 编译的二进制文件引起的错误,但我不知道如何解决该问题。任何帮助将不胜感激。 谢谢
ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64
此错误表示:您正在尝试将 64 位 _tabu_search.so
库加载到 32 位进程中。您必须使用 64 位 python
,或者安装 32 位版本的 tabu_search
软件包。
I suspect that the error has something to do with swig
不,SWIG
与您的问题几乎无关。