当我在Windows 10 64位(32位python)上将我的python 3.4应用程序编译成带有cx_freeze的可执行文件时,我从看似随机的导入尝试中间歇性地(大约1次在4中)获得以下运行时异常(例如import getpass / import QtCore):
zipimport.ZipImportError: can't decompress data; zlib not available
当我在启动时没有收到错误时,应用程序运行正常。一些说明:
1-我没有得到使用python 2.7构建的类似应用程序的异常。
2-直接从.pyw文件运行(即解冻)时,我没有得到异常。
跟踪:
File "c:\python\32-bit\3.4\lib\threading.py", line 921, in _bootstrap_inner
File ".\tempCheckout\CanPy\CanAsync.py", line 400, in run
File ".\tempCheckout\CanPy\CanAsync.py", line 483, in _connect
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File ".\tempCheckout\CanPy\CanSsh.py", line 1, in <module>
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File ".\tempCheckout\CanPy\CommUtil\SshTunnel.py", line 1, in <module>
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
zipimport.ZipImportError: can't decompress data; zlib not available
另外,我发现这似乎有关: cx_freeze "zlib not avaiable" error when using multiple threads
认为我的python 3.4应用程序正在使用两个依赖于zlib的外部库,并且它的使用存在锁定。这些库不在python 2.7中,因此我没有看到这个问题。如果我可以异步加载这些库,那么我可以解决这个问题。
答案 0 :(得分:0)
1- python 2.7应用程序没有加载zlib,所以这是一个红色的鲱鱼。
2-我认为.pyw中的时间一定是这样的,因为问题没有发生。