树莓派4B怎么将python程序打包成二进制

meteorlsl 20cm2024-09-24540 次点击
安装不上pyinstaller,在树莓派上有什么办法能够把python文件打包为二进制文件吗?
收藏 ♥ 感谢
Spoony 小组长 2024-09-25 
可以使用 pip 安装 pyinstaller

pip install pyinstaller

参考:https://www.cnblogs.com/wendaobiancheng/p/9772509.html
meteorlsl 20cm 2024-09-27 
用这个命令,会出现这个问题,安装不上
pip install pyinstaller
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
meteorlsl 20cm 2024-09-27 
用这个命令:sudo apt install python3-pyinstaller
找不到对应的安装包
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-pyinstaller
Tony 222.35m 2024-09-28  ♥ 1
meteorlsl 20cm 2024-11-20  ♥ 1
实测这个解决方案可用:
1:如果你习惯于原来的用法可以强制删除此警告:
sudo mv /usr/lib/python3.x/EXTERNALLY-MANAGED /usr/lib/python3.x/EXTERNALLY-MANAGED.bk
注意python版本号写你自己的别直接抄,不知道到底是多少可以进/user/lib看看:
find /usr/lib/ -type d -name "*python*"

登录注册 后可回复。