Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1025548
  • 博文数量: 171
  • 博客积分: 55
  • 博客等级: 民兵
  • 技术积分: 2077
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-04 10:11
个人简介

pugna

文章分类

全部博文(171)

文章存档

2021年(4)

2020年(1)

2019年(4)

2018年(5)

2017年(7)

2016年(9)

2015年(36)

2014年(8)

2013年(96)

2012年(1)

分类: Python/Ruby

2014-03-21 18:59:17

python3使用cxfreeze打包

/root/hhhh.py为源代码文件,打包过程如下:

[root@testos ~]# cxfreeze-quickstart
Project name: abc
Version [1.0]:
Description: abc
Python file to make executable from: /root/hhhh.py
Executable file name [/root/hhhh]:
(C)onsole application, (G)UI application, or (S)ervice [C]: C
Save setup script to [setup.py]:
Overwrite setup.py [n]? y

Setup script written to setup.py; run it as:
    python setup.py build
Run this now [n]? n
[root@testos ~]# python3 setup.py build
running build
running build_exe
copying /usr/local/lib/python3.3/site-packages/cx_Freeze-4.3.2-py3.3-linux-x86_64.egg/cx_Freeze/bases/Console -> build/exe.linux-x86_64-3.3/hhhh
writing zip file build/exe.linux-x86_64-3.3/library.zip
[root@testos ~]# cd build/exe.linux-x86_64-3.3
[root@testos exe.linux-x86_64-3.3]# ./hhhh
testos
################
192.1.1.10

需要特别注意的是,上面红色标注的部分,打包时不要指定,使用默认配置即可,否则可能最后打包的文件无法执行。

打包后,生成的可执行文件可以直接在本机运行,放到其它机器上也可以正常执行。当然,前期是,两者的运行环境就相同。
阅读(3954) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~