LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1413|回复: 4

无法编译python

[复制链接]
发表于 2006-6-5 11:10:13 | 显示全部楼层 |阅读模式
我的系统是winXP, python2.4, py2exe 0.6.5 ,  我的python装在C盘,是FAT32格式的.
  
    我输入 python setup.py py2exe之后出现一个错误提示:"SyntaxError: invalid syntax".

    请问各位知道是什么错误吗?我无法编译啊,找不到原因,各位帮帮忙啦.
发表于 2006-6-5 11:25:58 | 显示全部楼层
你想干什么?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-5 15:49:39 | 显示全部楼层
我写了一个python程序,想把它打包编译,让他在哪里都能直接运行.不过用这个py2exe工具打包不成功,出现这个出错信息,不知如何处理.
回复 支持 反对

使用道具 举报

发表于 2006-6-16 15:19:38 | 显示全部楼层
Well, form http://www.py2exe.org/ you can find this secton maybe something help to you

Using py2exe

Assuming you have written a python script myscript.py which you want to convert into an executable windows program, able to run on systems without a python installation. If you don't already have written a distutils setup-script, write one, and insert the statement import py2exe before the call to the setup function:

# setup.py
from distutils.core import setup
import py2exe

setup(console=["myscript.py"])

Running

python setup.py py2exe --help

will display all available command-line flags to the py2exe command.

Now you can call the setup script like in this way:

python setup.py py2exe

and a subdirectory dist will be created, containing the files myscript.exe, python23.dll, and library.zip. If your script uses compiled C extension modules, they will be copied here as well, also all dlls needed at runtime (except the system dlls).

These files include everything that is needed for your program, and you should distribute the whole directory contents.

The above setup script creates a console program, if you want a GUI program without the console window, simply replace console=["myscript.py"] with windows=["myscript.py"].

py2exe can create more than one exe file in one run, this is useful if you have a couple of related scripts. Pass a list of all scripts in the console and/or windows keyword argument.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-26 10:07:37 | 显示全部楼层
编译已经成功
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表