8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

在 python 中导入 .so 文件

Rick James 2月前

38 0

这个问题已经被问过无数次了,但在尝试了所有我能找到的方法后,我仍然得到了一个 ImportError。因此,我这样做了:import syssys.path.append(\'/usr/local/lib\')import

这个问题已经被问过无数次了,但是,在尝试了所有我能找到的方法之后,我仍然得到了一个 ImportError。因此,我这样做:

import sys

sys.path.append("/usr/local/lib")

import libIpxCameraApiPy # I've tried libIpxCameraApiPy.so as well

我得到:

ImportError: /usr/local/lib/libIpxCameraApiPy.so: cannot open shared object file: No such file or directory

值得一提的是:

  1. /usr/local/lib/ 中确实有一个名为 libIpxCameraApiPy.so 的文件
  2. 如果我这样做, cat /etc/ld.so.conf.d/libc.conf 我就会得到

# libc default configuration

/usr/local/lib

  1. p4

  2. p5

任何有助于使此导入工作顺利进行的帮助都将受到感谢。

帖子版权声明 1、本帖标题:在 python 中导入 .so 文件
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由Rick James在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 我一直在努力尝试使用 Ubuntu 24.04 LTS 中的 Kivy 将 \'hola mundo\' 部署到 android,但是我已经坚持了数周,出现这个错误,即未找到标头 readline.h......

    我一直在努力尝试在 ubuntu Ubuntu 24.04 LTS ,但我已经坚持了数周,这个错误是找不到标题 readline.h。我使用了 init 命令创建的标准 buildozer.spec,只是将要求更改为 requirements = python3==3.12.3, hostpython3==3.12.3,kivy==2.3.0

    我不知道如何分享整个日志,但这是最后一部分:

    
    
    /home/pablo/PycharmProjects/androidDeploy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Modules/readline.c -o Modules/readline.o
    > /home/pablo/PycharmProjects/androidDeploy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Modules/readline.c:39:12: fatal error: 'readline/readline.h' file not found
    > include <readline/readline.h>
    >            ^~~~~~~~~~~~~~~~~~~~~
    > 1 error generated.
    > make: *** [Makefile:3018: Modules/readline.o] Error 1
    > 
    > 
    > STDERR:
    > 
    > Command failed: ('/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=myapp', '--bootstrap=sdl2', '--requirements=python3==3.12.3,hostpython3==3.12.3,kivy==2.3.0', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/home/pablo/PycharmProjects/androidDeploy/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug')
    > Error code: 1
    > ENVIRONMENT:
    > SHELL = '/bin/bash'
    > SESSION_MANAGER = 'local/pablo-OptiPlex-3050:@/tmp/.ICE-unix/1622,unix/pablo-OptiPlex-3050:/tmp/.ICE-unix/1622'
    > QT_ACCESSIBILITY = '1'
    > COLORTERM = 'truecolor'
    > XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
    > XDG_MENU_PREFIX = 'gnome-'
    > GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
    > GNOME_SHELL_SESSION_MODE = 'ubuntu'
    > SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
    > MEMORY_PRESSURE_WRITE = 'c29tZSAyMDAwMDAgMjAwMDAwMAA='
    > XMODIFIERS = '@im=ibus'
    > DESKTOP_SESSION = 'ubuntu'
    > GTK_MODULES = 'gail:atk-bridge'
    > PWD = '/home/pablo/PycharmProjects/androidDeploy'
    > LOGNAME = 'pablo'
    > XDG_SESSION_DESKTOP = 'ubuntu'
    > XDG_SESSION_TYPE = 'wayland'
    > SYSTEMD_EXEC_PID = '1663'
    > XAUTHORITY = '/run/user/1000/.mutter-Xwaylandauth.OV0AR2'
    > HOME = '/home/pablo'
    > USERNAME = 'pablo'
    > IM_CONFIG_PHASE = '1'
    > LANG = 'en_US.UTF-8'
    > XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
    > MEMORY_PRESSURE_WATCH = '/sys/fs/cgroup/user.slice/user-1000.slice/[email protected]/session.slice/[email protected]/memory.pressure'
    > VTE_VERSION = '7600'
    > WAYLAND_DISPLAY = 'wayland-0'
    > GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/9329102b_46df_4d9d_b9de_7c08e5a177a1'
    > GNOME_SETUP_DISPLAY = ':1'
    > XDG_SESSION_CLASS = 'user'
    > TERM = 'xterm-256color'
    > USER = 'pablo'
    > GNOME_TERMINAL_SERVICE = ':1.121'
    > DISPLAY = ':0'
    > SHLVL = '1'
    > GSM_SKIP_SSH_AGENT_WORKAROUND = 'true'
    > QT_IM_MODULE = 'ibus'
    > XDG_RUNTIME_DIR = '/run/user/1000'
    > DEBUGINFOD_URLS = 'https://debuginfod.ubuntu.com '
    > XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop'
    > PATH = '/home/pablo/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/pablo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin'
    > GDMSESSION = 'ubuntu'
    > DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
    > OLDPWD = '/home/pablo/PycharmProjects/androidDeploy/buildozer'
    > _ = '/usr/local/bin/buildozer'
    > PACKAGES_PATH = '/home/pablo/.buildozer/android/packages'
    > ANDROIDSDK = '/home/pablo/.buildozer/android/platform/android-sdk'
    > ANDROIDNDK = '/home/pablo/.buildozer/android/platform/android-ndk-r25b'
    > ANDROIDAPI = '31'
    > ANDROIDMINAPI = '21'
    > 
    > Buildozer failed to execute the last command
    > The error might be hidden in the log above this error
    > Please read the full log, and search for it before
    > raising an issue with buildozer itself.
    > In case of a bug report, please add a full log with log_level = 2
    
    
    
    hope someone can orient me to find a solution. Thanks
    
返回
作者最近主题: