<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://blog.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://blog.liuts.com/post/138/</link>
<title><![CDATA[Pyinstaller建立linux下Python的独立可执行文件]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[Python]]></category>
<pubDate>Thu, 22 May 2008 14:02:54 +0000</pubDate> 
<guid>https://blog.liuts.com/post/138/</guid> 
<description>
<![CDATA[ 
	以下内容假定已安装好Python 2.4/2.5<br/><strong>一、下载并编译pyinstaller（只需做一次，以后可直接做第二步）</strong><br/>1.下载pyinstaller,现在的版本是1.3<br/>(1)wget http://pyinstaller.hpcf.upr.edu/source/1.3/pyinstaller_1.3.tar.gz<br/><br/>2.解包进入源码目录<br/>(1)tar zxv pyinstaller_1.3.tar.gz<br/>(2)cd pyinstaller-1.3/source/linux<br/><br/>3.编译源代码<br/>(1)python Make.py 生成python的 .pyc文件<br/><br/>如无错误，则出现如下提示（只有一行）：<br/>Now run "make" to build the targets: ../../support/loader/run ../../support/loader/run_d<br/><br/>(2)make 连接生成linux的 .o 文件<br/><br/>4.生成编译配置文件<br/>(1)python Configure.py 生成config.dat配置文件<br/><br/><strong>二、编译独立运行的python可执行文件</strong><br/><br/>1.生成spec文件<br/>python pyinstaller-1.3/Makespec.py --onefile --upx linuxlaptop.py<br/><br/>参数说明：<br/>--onefile 生成单文件<br/>--upx 生成压缩的文件（可减小执行文件体积，需先安装upx软件包）<br/><br/><br/>2.生成最终的可执行文件<br/>python pyinstaller-1.3/Build.py linuxlaptop.spec<br/><br/>执行完成后将在当前目录生成可执行的linuxlaptop文件，如有问题欢迎与我交流：linuxlaptop.cn。<br/>原文：<a href="http://bbs.chinaunix.net/thread-1328460-1-1.html" target="_blank">http://bbs.chinaunix.net/thread-1328460-1-1.html</a><br/><br/>============================个人实践=============================<br/>系统：Ubuntu 8.0.4<br/>安装相关包：apt-get install libc6-dev python-dev zlib1g-dev<br/>cd source/linux<br/>python ./Make.py<br/>make<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>cd ../../<br/>python Configure.py<br/>/pyinstaller-1.3/Makespec.py --onedir --icon=img/imac.ico my.py<br/>python /pyinstaller-1.3/Build.py my.spec<br/></div></div><br/>这时会提示pyinstaller-1.3中的几个包语法错误，估计源码包是在window下调试产生unix不识别的字符，典型的是换行符。<br/>安装dos2unix:sudo apt-get install tofrodos<br/>dos2unix /pyinstaller-1.3/pyinstaller-1.3/optparse.py......(6个文件左右)<br/><br/>再运行：python /pyinstaller-1.3/Build.py my.spec<br/>搞定，生成了distmy目录，里头有好多.o文件，类似于win下的dll:)<br/>Tags - <a href="https://blog.liuts.com/tags/pyinstaller/" rel="tag">pyinstaller</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/138/#blogcomment2598</link>
<title><![CDATA[[评论] Pyinstaller建立linux下Python的独立可执行文件]]></title> 
<author>aaa &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 04 Jun 2015 03:26:28 +0000</pubDate> 
<guid>https://blog.liuts.com/post/138/#blogcomment2598</guid> 
<description>
<![CDATA[ 
	&lt;script&gt;alert(&#039;1&#039;);&lt;/script&gt;
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post/138/#blogcomment2960</link>
<title><![CDATA[[评论] Pyinstaller建立linux下Python的独立可执行文件]]></title> 
<author>离别多 &lt;liyanyanlyy@qq.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 07 Jan 2025 01:50:06 +0000</pubDate> 
<guid>https://blog.liuts.com/post/138/#blogcomment2960</guid> 
<description>
<![CDATA[ 
	呵呵，学习了。
]]>
</description>
</item>
</channel>
</rss>