简体   繁体   English

Python 应用程序在 Raspbian Bullseye 上不起作用

[英]Debian package of Python Application not working on Raspbian Bullseye

I built a debian package of my Python 3 Application using dh-virtualenv.我使用 dh-virtualenv 构建了我的 Python 3 应用程序的 debian package。 On Raspbian Buster everything works fine but with the recent release of Bullseye I want the package to be compatible.在 Raspbian Buster 上一切正常,但最近发布的 Bullseye 我希望 package 兼容。

Sadly when I install the.deb under Bullseye, all my custom Python packages are missing.可悲的是,当我在 Bullseye 下安装.deb 时,我所有的自定义 Python 包都丢失了。 Running the Application throws a ModuleNotFoundError.运行应用程序会引发 ModuleNotFoundError。 I realised that the sys.path list did not contain the path to the site-packages of the virtualenv (which under Buster it does), so I appended it manually.我意识到 sys.path 列表不包含 virtualenv 的站点包的路径(它在 Buster 下),所以我手动添加了它。 This fixed the ModuleNotFoundError for most of the Python packages.这修复了大多数 Python 包的 ModuleNotFoundError。 However my application depends on some CPython packages as well and all those are still missing.然而,我的应用程序也依赖于一些 CPython 包,而所有这些包仍然缺失。

Running path/to/virtualenv/bin/pip3 list showed that they are not installed although I find all the correct.so and.dist-info files under the site-packages.运行path/to/virtualenv/bin/pip3 list显示它们尚未安装,尽管我在站点包下找到了所有正确的.so 和 .dist-info 文件。 Under Buster the same command listed all the extensions as expected.在 Buster 下,相同的命令按预期列出了所有扩展。

My guess is that the problem is caused by different Python versions being used.我的猜测是这个问题是由使用不同的 Python 版本引起的。 Buster uses 3.7 and Bullseye uses 3.9. Buster 使用 3.7,Bullseye 使用 3.9。 Do you have any ideas what could cause this problem and how I could fix it?你有什么想法可能导致这个问题以及我该如何解决它?

Thanks a lot Nathan非常感谢内森

I found the core of the problem.我找到了问题的核心。
Bullseye is using python 3.9 instead of busters python 3.7. Bullseye 正在使用 python 3.9 而不是破坏者 python 3.7。
So sys.path does not contain the correct path by default.所以 sys.path 默认不包含正确的路径。

For now I am fixing this by installing python 3.9 on my Buster build machine and tell the /debian/rules file to use python 3.9.现在我通过在我的 Buster 构建机器上安装 python 3.9 并告诉 /debian/rules 文件使用 python 3.9 来解决这个问题。
Then I manually append the correct path.然后我手动 append 正确的路径。

sys.path.append('/path/to/debian-package/lib/python3.9/site-packages')

Bullseye and Buster also use different versions of libffi (foreign function interface). Bullseye和Buster也使用不同版本的libffi (国外function接口)。
So since the CPython packages are depending on libffi, they do not get installed correctly.因此,由于 CPython 包依赖于 libffi,因此它们无法正确安装。
I fix this by installing libffi 7 on Buster.我通过在 Buster 上安装 libffi 7 来解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Python应用程序作为debian包分发,但作为服务 - Distributing Python application as a debian package, but as service 从 python 中停止 raspbian/debian - Stop raspbian/debian from within python Python Pillow没有使用raspbian - Python Pillow not working on raspbian 如何在Raspbian中安装python包? - how to install python package in Raspbian? 如何将 package Python GUI 应用程序转换为 Debian package 以在基于 debian 的操作系统或任何其他 linux 系统上运行? - How to package Python GUI application into Debian package to run on debian based operating system or any other linux systems? 从运行 fedora 的系统为我的 python 应用程序创建一个 debian 包 - Creating a debian package for my python application from a system running fedora 如何在RaspBerry Pi 3(Raspbian(Debian))中自动启动python脚本? - How autostart python script in RaspBerry Pi 3 (Raspbian (Debian))? ModuleNotFoundError:没有名为“_dbus_bindings”的模块 debian 11 靶心 python 3.9.2 - ModuleNotFoundError: No module named '_dbus_bindings' debian 11 bullseye python 3.9.2 Raspbian python virtualenv在拇指驱动器上不起作用 - raspbian python virtualenv not working on thumb drive 将virtualenv中的Python脚本打包到Debian软件包中 - Package Python script in virtualenv into a Debian package
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM