Mac下使用PyInstaller打包PyQt5

1. Mac下使用PyInstaller打包PyQt5文件

pyinstaller --windowed --onefile --clean --noconfirm demo.py
pyinstaller --clean --noconfirm --windowed --onefile demo.spec

这样打包后的应用程序在/dist/****.app目录下
或者:

pyinstaller -F demo.py

这样打包后的运行方式:

cd dist
./demo

2. 打包文件后运行应用程序出现闪退的解决方案

sudo pip uninstall pyinstaller
pip3 install pyinstaller

pip和pip3的区别:

一般来说,同一个版本的python目录下会有3个pip命令, 拿python3.6来说, 会有pip, pip3, pip3.6, 有两个可以看做别名或超链接。比如在Ubuntu系统下,python自带3.5.2 和2.7.12,这样使用pip 和pip3 就可以区分开来, 如果你再安装 anaconda 等python 科学计算环境, 比如版本是3.6, 这时你可以通过pip3.5 使用系统python3,当然也存在搜索路径优先的问题

另:在anaconda的env下也无法运行

你可能感兴趣的:(Mac下使用PyInstaller打包PyQt5)