Pyinstaller 打包python 到exe 在windows下免python环境运行python
来源:互联网 发布:淘宝客服昵称怎么设置 编辑:程序博客网 时间:2024/06/05 15:21
Python程序编写完之后需要进行打包发布
在windows下免python环境运行python程序怎么办呢?
打包成exe,直接在windows下运行
目前打包工具主要有三种
1.cx_Freeze
2.PyInstaller
3.py2exe
它们之间的比较
http://www.py2exe.org/index.cgi/FAQ
http://www.pyinstaller.org/
我选择了Pyinstaller ,因为实在是太好用了
- 下载Pyinstaller点击我传送到下载地址
绿色版只需解压到位置即可 - 有时可能需要pywin32,点我下载pywin32
- 将自己的程序拷贝到 Pyinstaller解压的文件夹中,我的是project.py
- cmd命令进去该目录,或者按住键盘Shift鼠标右键命令行
- 输入命令,如python pyinstaller.py -c -F project.py
其中 - c -F为编译条件 project为脚本名称
下面是编译条件指令介绍
-F, --onefile Py代码只有一个文件-D, --onedir Py代码放在一个目录中(默认是这个)-K, --tk 包含TCL/TK-d, --debug 生成debug模式的exe文件-w, --windowed, --noconsole 窗体exe文件(Windows Only)-c, --nowindowed, --console 控制台exe文件(Windows Only)-X, --upx 使用upx压缩exe文件-o DIR, --out=DIR 设置spec文件输出的目录,默认在PyInstaller同目录--icon=FILE.ICO 加入图标(Windows Only)-v FILE, --version=FILE 加入版本信息文件
注意:
如果是主程序调用子程序,主程序的import文件与子程序的import有差别
主程序在打包的时候一定要把子程序的import写入到主程序中才能一起打包,这样才不会出现调用子程序时出现 ImportError
阅读全文
0 0
- Pyinstaller 打包python 到exe 在windows下免python环境运行python
- Pyinstaller 打包python 到exe 在windows下免python环境运行python
- pyinstaller打包python成exe
- python打包exe之pyinstaller
- Python GUI打包程序pyinstaller在Windows环境下的搭建
- pyinstaller--将python打包成exe
- 使用pyinstaller打包python为exe文件
- Python之用pyinstaller打包成exe
- PyInstaller 打包 Python 源码为 exe 可执行文件
- 使用pyinstaller打包python为exe文件
- 使用pyinstaller打包python为exe文件
- python利用pyinstaller打包exe可执行文件
- 用Pyinstaller打包Python发布exe应用
- Python 使用pyinstaller打包exe程序
- Python | 用Pyinstaller打包发布exe应用
- python--利用PyInstaller打包exe程序
- python-利用pyinstaller打包成exe
- python to exe pyinstaller
- hdu 6118 度度熊的交易计划(费用流)
- 模建Bentley.STAAD.Pro.Connect.Edition.v21.00.00.57.build.08072017
- -NSArray和NSMutableArray
- Windows2012开机启动项设置
- Linux系统常用命令
- Pyinstaller 打包python 到exe 在windows下免python环境运行python
- OpenSceneGraph中文官方网站
- Python爬虫之爬取——使用代理
- HDU6108-小C的倍数问题
- Echarts更改仪表盘显示属性
- linux中服务的开启于关闭
- [ZJOI2006]物流运输trans
- Java排序算法之希尔排序
- android jniLibs下so库详解