我在使用cx_freeze冻结程序时遇到了很多麻烦。任何帮助,将不胜感激。当我冻结不使用numpy的东西但是我遇到麻烦时,我已经成功了,这似乎与numpy有关。
这是我尝试运行exe时的输出。
> Traceback (most recent call last):
File "F:\Anaconda3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "de_beams_xlw.py", line 2, in <module>
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "F:\Anaconda3\lib\site-packages\numpy\__init__.py", line 180, in <module>
from . import add_newdocs
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "F:\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "F:\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "F:\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2212, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "F:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 14, in <module>
from . import multiarray
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
File "c:\Python\64-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
File "ExtensionLoader_numpy_core_multiarray.py", line 22, in <module>
File "ExtensionLoader_numpy_core_multiarray.py", line 14, in __bootstrap__
ImportError: DLL load failed: The specified module could not be found.
我的设置文件:
from cx_Freeze import setup, Executable
build_exe_options = {'packages': ['win32com', 'xlwings', 'numpy'],
'excludes': ['scipy', 'email', 'xml', 'pandas', 'Tkinter',
'Tkconstants', 'pydoc', 'tcl', 'tk', 'matplotlib',
'PIL', 'nose', 'setuptools', 'xlrd', 'xlwt', 'PyQt4',
'markdown', 'IPython', 'docutils'],
'optimize': 2}
setup(name = 'de_beams_xlw',
version = '0.1.0',
options = {'build_exe': build_exe_options},
executables = [Executable('de_beams_xlw.py', targetName="de_beams_xlw.exe")])
答案 0 :(得分:0)
结束了包版本的组合。一旦我有正确的包装组合,它就可以正常工作。