[英]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.