Chinaunix

标题: py2exe 问题 [打印本页]

作者: rayen    时间: 2006-07-02 10:22
标题: py2exe 问题
使用python2.4 py2exe 0.6.5
\site-packages\pymssql.py 需要 ntwdblib.dll

setup.py

  1. from distutils.core import setup
  2. import py2exe
  3. import sys
  4. if len(sys.argv) == 1:
  5.     sys.argv.append("py2exe")
  6.     sys.argv.append("-q")

  7. setup(options = {"py2exe": {
  8.                            "compressed": 1,
  9.                           "optimize": 2}},
  10.       console=["DB.py"])
复制代码

运行 python setup.py
running py2exe
*** searching for required modules ***
*** parsing results ***
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
E:\Python24\python.exe -OO e:\docume~1\admini~1\locals~1\temp\tmptnvdaw.py
removing e:\docume~1\admini~1\locals~1\temp\tmptnvdaw.py
*** copy extensions ***
*** copy dlls ***
copying E:\Python24\Lib\site-packages\py2exe\run.exe -> C:\netgame\src\dist\DB.exe
Adding zlib.pyd to C:\netgame\src\dist\library.zip

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.

Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.

   USER32.dll - E:\WINDOWS\system32\USER32.dll
   ADVAPI32.dll - E:\WINDOWS\system32\ADVAPI32.dll
   KERNEL32.dll - E:\WINDOWS\system32\KERNEL32.dll
   ntwdblib.dll - E:\Python24\Lib\site-packages\ntwdblib.dll
   SHELL32.dll - E:\WINDOWS\system32\SHELL32.dll


然后运行DB.EXE
Traceback (most recent call last):
  File "DB.py", line 1, in ?
  File "pymssql.pyo", line 24, in ?
ImportError: No module named decimal

这是啥问题?在SHELL里运行OK的
作者: retsyo    时间: 2006-07-03 11:49
试试pyinstaller
作者: wolfg    时间: 2006-07-04 09:59
你的DB.py是GUI程序吗?
作者: rayen    时间: 2006-07-05 16:10
DB.py不是窗口程序,只是通过DB调用pymssql
作者: wolfg    时间: 2006-07-05 17:00
试试在你的DB.py里
import  decimal

http://mail.python.org/pipermail ... October/305596.html
作者: rayen    时间: 2006-07-10 12:05
可以了,谢谢
作者: appletian520    时间: 2008-05-04 12:37
但是生成的exe表格无法生成中文字段 在shell没有问题
作者: pumaboyd    时间: 2008-09-02 11:53
恩,很好。很不错。今天就碰到了这个问题




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2