这个cx_Freeze错误是什么意思?

时间:2014-08-07 09:56:39

标签: python windows cx-freeze python-3.4 pyzmq

在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 个答案:

答案 0 :(得分: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依赖项。如果该文件包含在冻结的应用程序中,则可以正常工作。