如何在win7 64位系统下用pyinstaller打包python代码成exe

如题所述

1、安装。使用PyInstaller需要安装PyWin32。
下载与Python对应的PyInstaller版本, 解压后就算安装好了 。
2、生成exe文件。Python程序的目录为 F:\hello.py
3、在命令行 中进入pyinstaller所在的目录,运行python pyinstaller.py F:\hello.py
4、在PyInstaller-2.1目录下,生成文件夹hello
5、hello目录下有文件,exe文件在dist目录下
6、如果将python文件复制到 pyinstaller.py 所在目录下,则运行 python pyinstaller.py hello.py
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-09-30
1.安装使用PyInstaller需要安装PyWin32。
下载与Python对应的PyInstaller版本, 解压后就算安装好了 。
2.生成exe文件
Python程序的目录为 F:\hello.py

在命令行 中进入pyinstaller所在的目录,运行python pyinstaller.py F:\hello.py

在PyInstaller-2.1目录下,生成文件夹hello

hello目录下有文件

exe文件在dist目录下

如果将python文件复制到 pyinstaller.py 所在目录下,则运行 python pyinstaller.py hello.py
3. pyinstaller的一些参数
(1) -F 制作独立的可执行程序,但是,运行生成的exe文件会包含警告。
相似回答
大家正在搜