py2exe 问题

py2exe 问题

使用python2.4 py2exe 0.6.5
\site-packages\pymssql.py 需要 ntwdblib.dll

setup.py

[Copy to clipboard] [ - ]
CODE:
from distutils.core import setup
import py2exe
import sys
if len(sys.argv) == 1:
    sys.argv.append("py2exe")
    sys.argv.append("-q")

setup(options = {"py2exe": {
                           "compressed": 1,
                          "optimize": 2}},
      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的
试试pyinstaller
你的DB.py是GUI程序吗?
DB.py不是窗口程序,只是通过DB调用pymssql
试试在你的DB.py里
import  decimal

http://mail.python.org/pipermail ... October/305596.html
可以了,谢谢
但是生成的exe表格无法生成中文字段 在shell没有问题
恩,很好。很不错。今天就碰到了这个问题