python编译so文件_请教 Python 如何调用 arm 编译的 so 文件?

so 文件信息

# readelf -h libencrypt.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: ARM

Version: 0x1

Entry point address: 0x0

Start of program headers: 52 (bytes into file)

Start of section headers: 16768 (bytes into file)

Flags: 0x5000000, Version5 EABI

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: 21

Section header string table index: 20

python 及系统版本信息( docker 容器)

[email protected]:/MyApp/pytest# python -V

Python 2.7.13

[email protected]:/MyApp/pytest# uname -a

Linux arm32v7-openjdk 4.9.41-moby #1 SMP Wed Sep 6 00:05:16 UTC 2017 armv7l GNU/Linux

python 代码

import ctypes

ll = ctypes.cdll.LoadLibrary

"""

1 有试过绝对路径和把这个库文件 copy 到 /usr/local/lib/ 目录下

2 文件肯定存在

3 权限是 777

"""

lib = ll("./libencrypt.so")

报错信息

[email protected]:/MyApp/pytest# python test.py

Traceback (most recent call last):

File "test.py", line 3, in

lib = ll("./libencrypt.so")

File "/usr/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary

return self._dlltype(name)

File "/usr/lib/python2.7/ctypes/__init__.py", line 362, in __init__

self._handle = _dlopen(self._name, mode)

OSError: ./libencrypt.so: cannot open shared object file: No such file or directory

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值