PyInstaller打包工具,使用以及pyinstaller权限问题,bash: pyinstaller: 未找到命令

PyInstaller

  1. 安装

pip install pyinstaller

  1. 基本用法

pyinstaller main.py

pyinstaller --onefile main.py

pyinstaller --onefile --name=hello main.py

  1. 常用参数

参数 说明

--onefile 将所有依赖打包成一个单独的可执行文件。没有这个选项时,生成的可执行文件将依赖于多个文件

--windowed 打包为 GUI 应用程序,不显示控制台窗口(仅适用于 Windows 和 macOS)

--name 指定生成的可执行文件的名称

--icon 为生成的可执行文件指定图标文件。图标文件通常为 .ico(Windows)或 .icns(macOS)格式。

--add-data 添加额外的数据文件。格式为 source:destination,其中 source 是本地路径,destination 是可执行文件内的路径。

--hidden-import 手动指定需要包含的模块。如果某些模块在运行时动态导入,PyInstaller 可能无法自动检测到这些依赖项

--exclude-module 手动排除某些模块

4.pyinstaller使用权限

bash: pyinstaller: 未找到命令

当使用root用户的时候使用pyinstaller提示未找到该命令,就会发现在普通用户下是可以使用的,那我们就来修改一下root用户下使用pyinstaller的权限问题

首先我们要找到pyinstaller安装的详细地址在哪里

find / -name pyinstaller

/usr/local/bin/这个就是我们安装的pyinstaller,我们去修改配置变量

vim ~/.bash_profile

保存,最后我们

source ~/.bash_profile

测试

相关推荐
金銀銅鐵2 小时前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup116 小时前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi008 小时前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵10 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf11 小时前
Agent 流程编排
后端·python·agent
copyer_xyf11 小时前
Agent RAG
后端·python·agent
copyer_xyf11 小时前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf12 小时前
Agent 记忆管理
后端·python·agent
星云穿梭1 天前
用Python写一个带图形界面的学生管理系统——完整教程
python