我想使用py2exe来打包python文件。
from distutils.core import setup
from glob import glob
import scipy
import numpy
import py2exe
import matplotlib
import wx
import sys
setup(
windows=["practice.py"],
options={"py2exe":
{"dll_excludes":["libiomp5md.dll",
"OLEAUT32.dll",
"USER32.dll",
"IMM32.dll",
"ole32.dll",
"MSVCP90.dll",
"SHELL32.dll",
"RPCRT4.dll",
"COMDLG32.dll",
"WSOCK32.dll",
"COMCTL32.dll",
"ADVAPI32.dll",
"WS2_32.dll",
"WINSPOOL.DRV",
"GDI32.dll",
"WINMM.dll",
"KERNEL32.dll",
"msvcm90.dll",
"msvcp90.dll",
"msvcr90.dll",
'libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll'],
"includes" : [ "matplotlib.backends",
"matplotlib.backends.backend_qt4agg",
"pylab",
"numpy",
"wx",
"scipy",
"matplotlib.backends.backend_tkagg"],
'excludes':['_gtkagg',
'_tkagg',
'_agg2',
'_cairo',
'_cocoaagg',
'_fltkagg',
'_gtk',
'_gtkcairo']
}
},
data_files=matplotlib.get_py2exe_datafiles()
)
但是,当我打开.exe
时,它会报告如下
Traceback (most recent call last):
File "practice.py", line 1, in <module>
File "matplotlib\__init__.pyc", line 180, in <module>
File "matplotlib\cbook.pyc", line 33, in <module>
File "numpy\__init__.pyc", line 168, in <module>
File "numpy\add_newdocs.pyc", line 13, in <module>
File "numpy\lib\__init__.pyc", line 18, in <module>
File "numpy\lib\polynomial.pyc", line 19, in <module>
File "numpy\linalg\__init__.pyc", line 50, in <module>
File "numpy\linalg\linalg.pyc", line 29, in <module>
File "numpy\linalg\lapack_lite.pyc", line 12, in <module>
File "numpy\linalg\lapack_lite.pyc", line 10, in __load
ImportError: DLL load failed: can't find specific modulus.
64bit windows8 python2.7.9
我在Stackoverflow中搜索并找到了一些答案,但是,它不起作用。
答案 0 :(得分:0)
你的numpy安装好吗?
&#34; numpy \ linalg \ linalg.pyc&#34;,第29行正在尝试加载
from numpy.linalg import lapack_lite, _umath_linalg
在我的安装中,我有lapack_lite.pyd和_umath_linalg.pyd。
但看起来你的numpy在某种程度上期待lapack_lite.pyc。我不知道他们为什么会有所不同,但也许重新安装numpy会有所帮助吗?
Numpy通常与py2exe表现得很好。