cx_freeze打包Python程序
2016-03-25 15:24
603 查看
Python程序打包成exe:
两种比较好的方法:cx_freeze和pyinstaller。
cx_freeze用起来简单,Pyinstaller功能强能打包成单个文件。
先说cx_freeze.
安装完cx_freeze以后创建cx_freeze.bat,方法如下:
python cxfreeze-postinstall
或者手懒的直接自己创建:
@echo off
C:\Python34\python.exe C:\Python34\Scripts\cxfreeze %*
之后新建一个Python文件,内容如下,运行下就成了,用于UI的,不想要黑框,就用下面的win32gui的。
# -*-coding:utf-8-*-
import os
__author__ = 'Adair'
dist_path = r'C:\Users\RF-LAB\Desktop\dist'
target_file = r'OTAcore.py'
# os.system(r'C:\Python34\Scripts\cxfreeze.bat %s --target-dir %s' % (target_file, dist_path))
os.system(r'C:\Python34\Scripts\cxfreeze.bat %s --target-dir %s --base-name=win32gui' % (target_file, dist_path)
两种比较好的方法:cx_freeze和pyinstaller。
cx_freeze用起来简单,Pyinstaller功能强能打包成单个文件。
先说cx_freeze.
安装完cx_freeze以后创建cx_freeze.bat,方法如下:
python cxfreeze-postinstall
或者手懒的直接自己创建:
@echo off
C:\Python34\python.exe C:\Python34\Scripts\cxfreeze %*
之后新建一个Python文件,内容如下,运行下就成了,用于UI的,不想要黑框,就用下面的win32gui的。
# -*-coding:utf-8-*-
import os
__author__ = 'Adair'
dist_path = r'C:\Users\RF-LAB\Desktop\dist'
target_file = r'OTAcore.py'
# os.system(r'C:\Python34\Scripts\cxfreeze.bat %s --target-dir %s' % (target_file, dist_path))
os.system(r'C:\Python34\Scripts\cxfreeze.bat %s --target-dir %s --base-name=win32gui' % (target_file, dist_path)
相关文章推荐
- python3 Unicode 编码转换中文显示
- python开发web服务器《一》
- python 遍历文件夹及文件
- python Django框架实现自定义表单提交
- Python接收开源中国GITOSC WebHook的POST数据
- python3.5之输出HTML实体字符
- python web
- 正则表达式匹配与查找
- python Django批量导入数据
- python Django批量导入不重复数据
- 手把手生成决策树(dicision tree)
- 用不动点组合子解递归(python实现)
- Python中如何把程序放到后台执行
- python2.7:创建修改删除目录
- 02python程序和用户交互
- 与Python Falling In Love_Python跨台阶(环境搭建)
- 关于Python中的*args和**kwargs
- python 查找相应图片数据路径并调用exe程序
- Python collections.defaultdict()
- Python的禅,“提姆彼得斯”说的非常有道理道出了这门编程语言的真谛!