python项目exe错误

时间:2013-10-05 07:54:14

标签: python windows exe

我使用eclipse + pydev(python2.7.5)编写了一个项目。在eclipse下一切顺利,但是当我想将项目包装到.exe时,它不起作用。我试了三个软件。

1.py2exe:

The following modules appear to be missing
 ['Carbon', 'Carbon.Files', 'OpenSSL.SSL', '_scproxy', '_sysconfigdata', 'builtin
 s', 'chardet', 'cjkcodecs.aliases', 'http.client', 'http.cookiejar', 'http.cooki
 es', 'iconv_codec', 'mx', 'ndg.httpsclient.ssl_peer_verification', 'ndg.httpscli
 ent.subj_alt_name', 'packages.ssl_match_hostname.CertificateError', 'packages.ss
 l_match_hostname.match_hostname', 'pyasn1.codec.der', 'queue', 'urllib.parse', '
 urllib.request']

但我没有使用任何这些数据包。

2.cx_freeze:

13:35:28: Debug: src/helpers.cpp(140): 'CreateActCtx' failed with error 0x000000
 7b (
 Traceback (most recent call last):
   File "main.py", line 20, in <module>
   File "zipextimporter.pyo", line 82, in load_module
   File "sunrise\system\conf.pyo", line 14, in <module>
   File "zipextimporter.pyo", line 82, in load_module
   File "anydbm.pyo", line 53, in <module>
 ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm', 'dumbdbm']

3.pyinstaller打包时没有错误,但运行时,

_("鍙戝竷缃戦〉鍚庡彲娴忚?缃戦〉鐗堬細http://"+self.dbm[self.conf.HOST_NAME
 ]+"/"+self.dbm[self.conf.PORT_NUMBER]), "",style=wx.NO_BORDER | wx.HL_ALIGN_CENT
 RE | wx.HL_CONTEXTMENU)
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_controls.py", line
 6632, in __init__
     _controls_.HyperlinkCtrl_swiginit(self,_controls_.new_HyperlinkCtrl(*args, *
 *kwargs))
 UnicodeDecodeError: 'gbk' codec can't decode bytes in position 22-23: illegal mu
 ltibyte sequence
 15:03:53: Debug: ..\..\include\wx/msw/private.h(697): 'UnregisterClass' failed w
 ith error 0x00000584 (

似乎错误是因为中文字符编码错误。但我在所有代码之前添加了“# - * - coding:UTF-8”。日食的环境已经设定为utf-8。 有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

检查所有字符串(带有特殊字符)是否标记为 unicode u"你好"