今天在linux环境下安装pyinstaller,环境为python3,安装步骤如下:

1、命令安装pyinstaller

pip3 install pyinstaller    #pip3对应python3版本,根据自己版本需要安装

pip3 show pyinstaller    #查看是否安装成功,如果成功,显示结果会有pyinstaller路径,后面需要用到

2、打包程序

pyinstaller -F **.py

突然报错“bash: pyinstaller: 未找到命令...”,原因是没有将pyinstaller所在目录加入环境变量中。

echo $PATH    #查看当前用户的环境变量是否包含pyinstaller

vim /home/zzz/.bash_profile     #zzz为当前用户名

#在配置文件中加入pyinstaller的路径,第一步pip3 show pyinstaller可查找路径
PATH=$PATH:/home/zzz/.local/lib/python3.7/site-packages     

source /home/zzz/.bash_profile    #使修改命令生效

 3、重新验证pyinstaller在终端使用情况

因此,如果出现没找到命令的情况,首先考虑包是不是没有安装好?环境是不是没有配好?

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐