<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu,debian,redhat -linuxany.com &#187; py2exe</title>
	<atom:link href="http://www.linuxany.com/archives/tag/py2exe/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2012 08:59:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Python:py2exe的使用方法总结</title>
		<link>http://www.linuxany.com/archives/557.html</link>
		<comments>http://www.linuxany.com/archives/557.html#comments</comments>
		<pubDate>Thu, 13 Nov 2008 21:10:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[py2exe]]></category>

		<guid isPermaLink="false">http://www.linuxlaptop.cn/?p=557</guid>
		<description><![CDATA[一、简介 py2exe是一个将python脚本转换成windows上的可独立执行的可执行程序(*.exe)的工具，这样，你就可以不用装python而在windows系统上运行这个可执行程序。 py2exe已经被用于创建wxPython,Tkinter,Pmw,PyGTK,pygame,win32com client和server,和其它的独立程序。py2exe是发布在开源许可证下的。 二、安装py2exe 从http://prdownloads.sourceforge.net/py2exe下载并运行与你所安装的Python对应的py2exe版本的installer，这将安装py2exe和相应的例子；这些例子被安装在lib\site-packages\py2exe\samples目录下。 三、py2exe的用法 如果你有一个名为myscript.py的python脚本，你想把它转换为运行在windows上的可执行程序，并运行在没有安装python的windows系统上，那么首先你应写一个用于发布程序的设置脚本例如mysetup.py，在其中的setup函数前插入语句import py2exe 。 mysetup.py示例如下: # mysetup.py from distutils.core import setup import&#160;py2exe &#160; setup(console=[&#34;myscript.py&#34;]) 然后按下面的方法运行mysetup.py: python mysetup.py py2exe 上面的命令执行后将产生一个名为dist的子目录，其中包含了myscript.exe,python24.dll,library.zip这些文件。 如果你的myscript.py脚本中用了已编译的C扩展模块，那么这些模块也会被拷贝在个子目录中，同样，所有的dll文件在运行时都是需要的，除了系统的dll文件。 dist子目录中的文件包含了你的程序所必须的东西，你应将这个子目录中的所有内容一起发布。 默认情况下，py2exe在目录dist下创建以下这些必须的文件： 1、一个或多个exe文件。 2、python##.dll。 3、几个.pyd文件，它们是已编译的扩展名，它们是exe文件所需要的；加上其它的.dll文件，这些.dll是.pyd所需要的。 4、一个library.zip文件，它包含了已编译的纯的python模块如.pyc或.pyo 上面的mysetup.py创建了一个控制台的myscript.exe程序，如果你要创建一个图形用户界的程序，那么你只需要将mysetup.py中的console=["myscript.py"]替换为windows=["myscript.py"]既可。 py2exe一次能够创建多个exe文件，你需要将这些脚本文件的列表传递给console或windows的关键字参数。如果你有几个相关联的脚本，那么这是很有用的。 运行下面个命令，将显示py2exe命令的所有命令行标记。 python mysetup.py py2exe --help 四、指定额外的文件 一些应用程序在运行时需要额外的文件，诸如配置文件、字体、位图。 如果在安装脚本中用data_files可选项指定了那些额外的文件，那么py2exe能将这些文件拷贝到dist子目录中。data_files应包含一个元组(target-dir, files)列表，其中的files是这些额外的文件的列表。 示例如下： # mysetup.py from distutils.core import setup import&#160;glob import&#160;py2exe &#160; setup(console=[&#34;myscript.py&#34;], &#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/557.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

