pyinstaller raspberry pi 编译,如何从命令行执行程序

pyinstaller raspberry pi compiling, how to execute program from command line

这个可执行文件生成在 raspbian linux,在我的树莓派上:

安装 pyinstaller:(我不得不尝试几次,因为我收到错误 "http.client.RemoteDisconnected: Remote end closed connection without response" 但它突然起作用了):

$ pip3 安装 pyinstaller

在我的 tiny_test.py 文件的目录中:

$ pyinstaller -F tiny_test.py

然后,在创建的 dist 文件夹中,我尝试 运行 编译后的可执行文件: $tiny_test

这给出了错误:

"tiny_test: tiny_test: cannot execute binary file"

简答:

$./tiny_test

长答案:

检查可执行文件属性:

$ 文件 tiny_test

"tiny_test:ELF 32 位 LSB 可执行文件,ARM,EABI5 版本 1 (SYSV),动态链接,解释器 /lib/ld-linux-armhf.so.3,适用于 GNU/Linux 3.2。 0,BuildID[sha1]=ad32521ad141d04ca4fc066798301621367c7964,剥离

LSB 可执行文件需要 运行 像这样:

$./tiny_test

这对我有用!