Chinaunix首页 | 论坛 | 博客
  • 博客访问: 659112
  • 博文数量: 139
  • 博客积分: 2655
  • 博客等级: 少校
  • 技术积分: 1723
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-02 16:03
文章分类

全部博文(139)

文章存档

2013年(2)

2011年(17)

2010年(14)

2009年(86)

2008年(20)

分类: Python/Ruby

2009-02-22 22:32:53

今天在网上瞎逛,看到一篇介绍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)


阅读(2310) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~