当前位置: 首页 > article >正文

Linux python pyinstaller 打包问题

1.环境

系统版本:Linux -4.19.91-24.8.el8.ks8.11.x86_64-x86_64-with-kylin-10-Sun

python 版本 :3.11.2

pyinstaller  :6.10.0

pyinstaller 安装不在说明

2.打包

[root@localhost pythonNacos]# /usr/local/python3.11/bin/pyinstaller --onefile --noconsole   TestNacos.py 
88 INFO: PyInstaller: 6.10.0, contrib hooks: 2024.8
88 INFO: Python: 3.11.2
90 INFO: Platform: Linux-4.19.91-24.8.el8.ks8.11.x86_64-x86_64-with-glibc2.28
90 INFO: Python environment: /usr/local/python3.11
90 INFO: wrote /data/pythonNacos/TestNacos.spec
91 INFO: Module search paths (PYTHONPATH):
['/usr/local/python3.11/lib/python311.zip',
 '/usr/local/python3.11/lib/python3.11',
 '/usr/local/python3.11/lib/python3.11/lib-dynload',
 '/usr/local/python3.11/lib/python3.11/site-packages',
 '/data/pythonNacos']
158 INFO: checking Analysis
158 INFO: Building Analysis because Analysis-00.toc is non existent
158 INFO: Running Analysis Analysis-00.toc
158 INFO: Target bytecode optimization level: 0
158 INFO: Initializing module dependency graph...
158 INFO: Caching module graph hooks...
169 INFO: Analyzing base_library.zip ...
732 INFO: Processing standard module hook 'hook-heapq.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
756 INFO: Processing standard module hook 'hook-encodings.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
2474 INFO: Processing standard module hook 'hook-pickle.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
4083 INFO: Caching module dependency graph...
4154 INFO: Looking for Python shared library...
4163 INFO: Using Python shared library: /usr/local/python3.11/lib/libpython3.11.so.1.0
4163 INFO: Analyzing /data/pythonNacos/TestNacos.py
4501 INFO: Processing pre-safe-import-module hook 'hook-typing_extensions.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks/pre_safe_import_module'
4503 INFO: SetuptoolsInfo: initializing cached setuptools info...
5398 INFO: Processing standard module hook 'hook-platform.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
5448 INFO: Processing standard module hook 'hook-multiprocessing.util.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
5526 INFO: Processing standard module hook 'hook-xml.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
5888 INFO: Processing standard module hook 'hook-sysconfig.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
6302 INFO: Processing standard module hook 'hook-difflib.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks'
6369 INFO: Processing pre-safe-import-module hook 'hook-importlib_metadata.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks/pre_safe_import_module'
6537 INFO: Processing standard module hook 'hook-jinja2.py' from '/usr/local/python3.11/lib/python3.11/site-packages/_pyinstaller_hooks_contrib/stdhooks'
7561 INFO: Processing module hooks (post-graph stage)...
7624 INFO: Performing binary vs. data reclassification (2 entries)
7630 INFO: Looking for ctypes DLLs
7752 INFO: Analyzing run-time hooks ...
7756 INFO: Including run-time hook 'pyi_rth_inspect.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks/rthooks'
7761 INFO: Including run-time hook 'pyi_rth_pkgutil.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks/rthooks'
7767 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' from '/usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/hooks/rthooks'
7785 INFO: Looking for dynamic libraries
8025 INFO: Warnings written to /data/pythonNacos/build/TestNacos/warn-TestNacos.txt
8043 INFO: Graph cross-reference written to /data/pythonNacos/build/TestNacos/xref-TestNacos.html
8055 INFO: checking PYZ
8055 INFO: Building PYZ because PYZ-00.toc is non existent
8055 INFO: Building PYZ (ZlibArchive) /data/pythonNacos/build/TestNacos/PYZ-00.pyz
8545 INFO: Building PYZ (ZlibArchive) /data/pythonNacos/build/TestNacos/PYZ-00.pyz completed successfully.
8553 INFO: checking PKG
8553 INFO: Building PKG because PKG-00.toc is non existent
8553 INFO: Building PKG (CArchive) TestNacos.pkg
21010 INFO: Building PKG (CArchive) TestNacos.pkg completed successfully.
21018 INFO: Bootloader /usr/local/python3.11/lib/python3.11/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run
21018 INFO: checking EXE
21018 INFO: Building EXE because EXE-00.toc is non existent
21018 INFO: Building EXE from EXE-00.toc
21019 INFO: Copying bootloader EXE to /data/pythonNacos/dist/TestNacos
21020 INFO: Appending PKG archive to custom ELF section in EXE
21294 INFO: Building EXE from EXE-00.toc completed successfully.

3.问题

/usr/local/python3.11/bin/pyinstaller --onefile --noconsole   TestNacos.py 
/usr/local/python3.11/bin/python3.11: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory

首先查看安装路径下面有没有 这个共享库

如果存在  cd /etc/ld.so.conf.d 

创建 python3.py  增加共享库路径

完成后 执行 ldconfig

再次执行成功

如果共享库不存在需要重新编译安装python 

./configure --prefix=/usr/local/python3.11/ --enable-shared
make   

make install

arm 下离线安装 pyinstaller 

可以查看pyinstaller  依赖关系

首先升级pip 默认是22.3升级到24.2

提前下载好安装包

python3  -m pip install  --upgrade    pip  pip-24.2-py3-none-any.whl
pip install   altgraph-0.17.4-py2.py3-none-any.whl
pip install   packaging-24.1-py3-none-any.whl
pip install   pyinstaller_hooks_contrib-2024.8-py3-none-any.whl

注意安装顺序先安装依赖最后在安装pyinstaller-6.10.0-py3-none-manylinux2014_aarch64.whl

pip install  pyinstaller-6.10.0-py3-none-manylinux2014_aarch64.whl


http://www.kler.cn/a/304567.html

相关文章:

  • 初级数据结构——栈
  • C++STL容器——map和set
  • Springboot配置全局异常通用返回
  • 认识一下Unicorn
  • HTTP常见的请求头有哪些?都有什么作用?在 Web 应用中使用这些请求头?
  • Linux如何更优质调节系统性能
  • 基于React通用的 WebSocket 钩子 useWebSocket
  • 二进制部署ETCD单机版
  • VITS 源码解析2-模型概述
  • 3.ChatGPT在教育领域的应用:教学辅助与案例分享(3/10)
  • 【kafka】消息队列
  • OpenHarmony鸿蒙( Beta5.0)摄像头实践开发详解
  • RK3588人工智能学习笔记-WSL中使用RKNN-ToolKit2
  • OpenAI全新发布o1模型:开启 AGI 的新时代
  • Kafka下载与安装教程(国产化生产环境无联网服务器部署实操)
  • Ubuntu 22.04 源码下载的几种方法
  • QT:音视频播放器
  • 使用Python自动抓取亚马逊网站商品信息
  • 1. 运动控制指令概要(omron 机器自动化控制器)
  • 【MySQL】数据库的操作【字符集和校验规则】【对数据库进行操作】【数据库备份与恢复】
  • Axure多人协调的方式
  • c++207 运算重载
  • 【从问题中去学习k8s】k8s中的常见面试题(夯实理论基础)(二十八)
  • 【AWDP】 AWDP 赛制详解应对方法赛题实践 量大管饱
  • 2.大语言模型LLM的涌现能力和关键技术
  • 计算机网络 --- 【2】计算机网络的组成、功能