免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2268 | 回复: 0
打印 上一主题 下一主题

pyinstaller的使用 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-22 22:32 |只看该作者 |倒序浏览
今天在网上瞎逛,看到一篇介绍pyinstaller的文章(现在才看到,太落伍了,那个汗~~):就是让你的python程序在没有装python的机器上运行。就从
其主页
上下了1.3的,按照说明操作。但 python ./Make.py之后的make一直报错,仔细看了错误说明:
gcc -pthread  -I/usr/include -I/usr/local/include/python2.5 -I../common
-DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC
-fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -DHAVE_WARNINGS -c
getpath.c -o getpath.o
getpath.c:39:20: error: Python.h: No such file or directory
getpath.c:40:20: error: osdefs.h: No such file or directory
getpath.c:54: error: ‘MAXPATHLEN’ undeclared here (not in a function)
getpath.c: In function ‘reduce’:
getpath.c:63: error: ‘SEP’ undeclared (first use in this function)
getpath.c:63: error: (Each undeclared identifier is reported only once
getpath.c:63: error: for each function it appears in.)
getpath.c: In function ‘joinpath’:
getpath.c:135: error: ‘SEP’ undeclared (first use in this function)
getpath.c: In function ‘calculate_path’:
getpath.c:152: warning: implicit declaration of function ‘Py_GetProgramName’
getpath.c:152: warning: initialization makes pointer from integer without a cast
getpath.c:159: error: ‘SEP’ undeclared (first use in this function)
getpath.c:169: warning: implicit declaration of function ‘getenv’
getpath.c:169: warning: assignment makes pointer from integer without a cast
getpath.c:177: error: ‘DELIM’ undeclared (first use in this function)
getpath.c:197: warning: implicit declaration of function ‘free’
getpath.c:197: warning: incompatible implicit declaration of built-in function ‘free’
getpath.c:157: warning: unused variable ‘numchars’
getpath.c:153: warning: unused variable ‘argv0_path’
make: *** [getpath.o] Error 1
发现是Python.h 和osdefs.h没找到,查了下/usr/include/python2.5/是有的,再看了下getpath.c里的include,发现是
#include "Python.h"#include "osdefs.h"
改成
#include "python2.5/Python.h"#include "python2.5/osdefs.h"
重新make(好像还有一个要改的,是../common/launch.c),虽然还有很多警告,但是通过了。
接着
python Configure.py
python Makespec.py /path/to/yourscript.py
(这个Makespec.py源文件里#! /usr/bin/env/python  要修改成#! /usr/bin/env   python )
python Build.py /path/to/yourscript.spec
会在yourscript.py的目录下生成distyourscript目录,里面是不依赖python的可执行文件,相对于源文件确实很大(我的一个606字节的文件,生成的distyourscript有9.3M)
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/65354/showart_1839078.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP