无法打开共享对象文件:使用python在raspberry pi中没有这样的文件或目录

时间:2018-01-05 09:51:29

标签: python python-2.7 raspberry-pi

这里我尝试使用python 2.7在raspberry pi中导入'libEpsonF​​iscalDriver.so'文件。以下是我在python中的步骤

>>>import ctypes
>>>ctypes.cdll.LoadLibrary('/home/pi/odoo/my_module/escpos/lib/libEpsonFiscalDriver.so')
    Traceback (most recent call last):
      File "", line 1, in 
      File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
        return self._dlltype(name)
      File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: /home/pi/odoo/my_module/escpos/lib/libEpsonFiscalDriver.so: cannot open shared object file: No such file or directory

所以我在这里得到了这个错误。

额外信息:libEpsonF​​iscalDriver.so文件的标题信息。

readelf -h libEpsonF​​iscalDriver.so

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x5de0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          125176 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         7
  Size of section headers:           40 (bytes)
  Number of section headers:         29
  Section header string table index: 26

更多信息,我已经使用安装了Ubuntu的其他系统测试了相同的代码,并且在那里工作正常。因为,lib header将Machine列为Intel 80386.我认为这个lib只适用于Intel Architecture。这是件事还是我错过了什么?

任何帮助都将不胜感激!谢谢。

1 个答案:

答案 0 :(得分:0)

lib与Raspberry Pi不兼容,因为架构不同。如果要在Pi上使用它,则需要找到该驱动程序的基于ARM的版本。