我想appimage
用来捆绑一个基于 PyQt 的 python 应用程序。为此,我使用appimage-builder
. 将执行 appimage 构建的机器是 a debian/buster
(默认情况下与 python 3.7.3 一起提供)。根据文档,我派生了以下 appimage-builder 配置文件:
version: 1
script:
# Remove any previous build
- rm -rf AppDir | true
# Make src dirs
- mkdir -p AppDir/usr/src
# Make icons dirs
- mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps/
# Copy the icon to icons dir
- cp ./icons/passhfiles_256.png AppDir/usr/share/icons/hicolor/256x256/apps/passhfiles.png
# Make bin dirs
- mkdir -p AppDir/usr/bin
# Install application dependencies
- python3 -m pip install --ignore-installed --prefix=/usr --root=AppDir ../..
AppDir:
path: ./AppDir
app_info:
id: Institut Laue Langevin
name: passhfiles
icon: passhfiles
version: 1.0.0
# Set the python executable as entry point
exec: usr/bin/python3
# Set the application main script path as argument. Use '$@' to forward CLI parameters
exec_args: "$APPDIR/usr/bin/passhfiles"
apt:
arch: amd64
sources:
- sourceline: 'deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse'
key_url: 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3b4fe6acc0b21f32'
include:
- python3
exclude: []
runtime:
version: "continuous"
env:
PATH: '${APPDIR}/usr/bin:${PATH}'
# Set python home
# See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHOME
PYTHONHOME: '${APPDIR}/usr'
# Path to the site-packages dir or other modules dirs
# See https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH
PYTHONPATH: '${APPDIR}/usr/lib/python3.8/site-packages'
AppImage:
update-information: 'gh-releases-zsync|AppImageCrafters|python-appimage-example|latest|python-appimage-*x86_64.AppImage.zsync'
sign-key: None
arch: x86_64
构建看起来不错,但是当我运行图像时,我收到 PyQt 的导入错误。检查图片的内容,发现里面有两条蟒蛇usr/lib
:apython 3.7
和a python 3.8
。我猜python 3.7来自构建机器的python是python 3.7,而python 3.8来自捆绑过程中安装的python(ubuntu/focal
用作源代码行)。您知道我的设置有什么问题以及如何解决吗?