尝试导入使用 swig 的 python 库时出现“错误的 ELF 类”错误

我一直在尝试导入一个名为 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 编译的二进制文件引起的错误,但我不知道如何解决该问题。任何帮助将不胜感激。谢谢


弑天下
浏览 190回答 1
1回答

海绵宝宝撒

ImportError: /home/chip/.local/lib/python3.5/site-packages/tabu/_tabu_search.so: wrong ELF class: ELFCLASS64此错误意味着:您正在尝试将 64 位_tabu_search.so库加载到 32 位进程中。您必须使用 64-bitpython或安装 32-bit 版本的tabu_search包。我怀疑这个错误与 swig 有关不,SWIG几乎与你的问题无关。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python