这个 cx_Freeze 错误是啥意思?
Posted
技术标签:
【中文标题】这个 cx_Freeze 错误是啥意思?【英文标题】:What does this cx_Freeze error mean?这个 cx_Freeze 错误是什么意思? 【发布时间】:2014-08-07 09:56:39 【问题描述】:在尝试在 Windows 7 上 cx_Freeze 依赖于 pyzmq 的 Python 3.4 应用程序时,我在运行我无法理解的可执行文件时遇到异常。为简洁起见,已编辑回溯的错误如下所示:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\cx_freeze-4.3.3-py3.4-win32.egg\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
[...]
File "Q:\Users\arvek\Repositories\accc-gui\aiozmq\aiozmq\__init__.py", line 4, in <module>
import zmq
File "C:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Python34\lib\site-packages\zmq\__init__.py", line 49, in <module>
from zmq.backend import *
File "C:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Python34\lib\site-packages\zmq\backend\__init__.py", line 41, in <module>
reraise(*exc_info)
File "C:\Python34\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Python34\lib\site-packages\zmq\backend\__init__.py", line 29, in <module>
_ns = select_backend(first)
File "C:\Python34\lib\site-packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Python34\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
File "C:\Python34\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
_call_with_frames_removed(import_, from_name)
File "C:\Python34\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
return f(*args, **kwds)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Python34\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Python34\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "ExtensionLoader_zmq_backend_cython_error.py", line 22, in <module>
File "ExtensionLoader_zmq_backend_cython_error.py", line 14, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
此错误的具体原因是什么,即缺少哪个模块(我认为是 DLL)?
【问题讨论】:
【参考方案1】:提示位于以下回溯条目中:
File "C:\Python34\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
它没有直接回答问题所在,但确实指出模块 zmq.backend.cython.constants 等是问题所在,即它们缺少 DLL 依赖项。在检查 DependencyWalker 后,发现 'C:\Python34\lib\site-packages\zmq\libzmq.pyd' 是有问题的 DLL 依赖项。如果该文件包含在冻结的应用程序中,它就可以工作。
【讨论】:
以上是关于这个 cx_Freeze 错误是啥意思?的主要内容,如果未能解决你的问题,请参考以下文章