0

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

1.py2exe:</p>

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打包的时候没有报错,但是运行的时候:</p>

_("鍙戝竷缃戦〉鍚庡彲娴忚?缃戦〉鐗堬細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”。并且 eclipse 的环境已经设置为 utf-8。谁能帮助我?

4

1 回答 1

0

检查您的所有字符串(带有特殊字符)是否都标记为unicodeu"你好"

于 2013-10-05T08:49:09.540 回答