py2exe with enthought and pandas

五迷三道 提交于 2019-12-21 22:58:18

问题


I am trying to make an executable with python, py2exe using Enthought. The program.py starts with:

import pandas as pd
import pyper as pr
r=pr.R(use_pandas=True)

The setup.py is as below:

from distutils.core import setup
import py2exe
import matplotlib
import sys
opts={"py2exe":{"bundle_files"}}
sys.argv.append('py2exe')
opts = {'py2exe': {"bundle_files" : 3, "includes" : [ "matplotlib.backends", "matplotlib.backends.backend_qt4agg", "pylab","numpy", "matplotlib.backends.backend_tkagg"], 'excludes':['_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg', '_fltkagg', '_gtk', '_gtkcairo'], 'dll_excludes': ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll']}}
setup(console=['program.py'],zipfile=None,options=opts,data_files=matplotlib.get_py2exe_datafiles())

After running:python setup.py py2exe the two folders dist and build were created. But when launched program.exe I got this:

Dll load failed: The specified module could not be found
Traceback (most recent call last):  
File "program.py", line 1, in module  
File "pandas\__init__.pyc", line 6, in module  
File "pandas\hashtable.pyc", line 12, in module  
File "pandas\hashtable.pyc", line 10, in module  
File "numpy.pxd.", line 157, in init pandas.hastable (pandas\hastable.c:19547)  
File "numpy\__init__.pyc", line 143, in module  
File "numpy\lib\add_newdocs.pyc", line 9, in module  
File "numpy\lib\__init__.pyc", line 13, in module  
File "numpy\lib\polynomial.pyc", line 17, in module  
File "numpy\linalg\__init__.pyc", line 48, in module  
File "numpy\linalg\linalg.pyc", line 23, 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: The specified module could not be found** 

I'm using Canopy 1.1.0 with Pandas 0.12.0-2 on a 64-Windows 7

Thanks for any help.


回答1:


It looks as though the .exe built by py2exe may be missing the Intel MKL DLLs that come with Canopy (EPD). Depending on which version of Canopy (EPD) you have, the NumPy DLLs may be linked against the Intel MKL DLLs. Those DLLs should be in C:\Python27\Scripts directory (or the corresponding Scripts directory if you've installed EPD in a different place) -- look for DLLs whose filename starts with mk2.


EDIT: The path above works only for older EPD versions. For a more recent version of Canopy, the DLLS are typically located somewhere like C:\Users\<user>\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.1.0-1371-win-x86_64\Scripts



来源:https://stackoverflow.com/questions/18869421/py2exe-with-enthought-and-pandas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!