Python 抓取小说爬虫
wxpython 获得poj上自己代码的小工具

cx_freeze和py2exe打包py程序笔记

scturtle posted @ 2010年5月20日 03:53 in python , 6730 阅读

环境: python 2.6  win7  cx_freeze4.1.2  py2exe-0.6.9.win32-py2.6

cx_freeze打包tkinter程序的话,setup.py里写入tk\tcl目录如:

# -*- coding: utf-8 -*-
from cx_Freeze import setup, Executable  

includeFiles = [
     ( r"D:\lib\Python26\tcl\tcl8.5", "tcl"),  
     ( r"D:\lib\Python26\tcl\tk8.5", "tk")  
	]

setup(
        name = "hello",
        version = "0.1",
        description = "Sample cx_Freeze script",
        options = {"build_exe": {"include_files": includeFiles,}},  
  
        executables = [Executable("test.py",base="Win32GUI")])

(命令行程序去掉base那个选项)

在当前目录下执行(需把python地址加入环境变量):

python setup.py build

 

py2exe的setup.py写成:

# -*- coding: utf-8 -*-
# setup.py
from distutils.core import setup
import py2exe

setup(windows=["mine.pyw"])

不用像cx_freeze在意tkinter,命令行程序把最后一行的windows换成console

在当前目录下执行:

python setup.py py2exe

 

OK! 笔记完成!

 

补充:

py2exe打包wxpython程序时遇到找不到msvcp9.dll

需下载MSVCP90.DLL 并拷贝到Python26/DLLs 目录下

setup.py写成:

# -*- coding: utf-8 -*-
# setup.py
from distutils.core import setup
import py2exe

setup(
	windows=["test.pyw"],
	options = {           
	"py2exe":  
	{"dll_excludes":["MSVCP90.dll"]}  
	}
)
JK Board 10th Class 说:
2022年8月24日 19:40

JKBOSE 10th Question Paper 2023, Jammu And Kashmir conduct all secondary and higher secondary examinations all over the state. JK Board 10th Class Model Paper 2023 PDF All candidates who belong to Jammu and Kashmir Board can check all Educational activities details like Admission, Examination, New Question Paper, entry card, and result from JKBOSE official website.JKBOSE 10th Question Paper 2023, Jammu And Kashmir conduct all secondary and higher secondary examinations all over the state.

seo service london 说:
2023年11月01日 18:34

I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. 


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter