本文介绍了py2exe与思想和 pandas 的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Enthought 使用python,py2exe创建可执行文件. program.py 以以下字符开头:

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)

setup.py 如下:

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())

运行后:python setup.py py2exe创建了两个文件夹 dist build .但是启动 program.exe 时,我得到了:

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**

我在64台Windows 7上使用Canopy 1.1.0和Pandas 0.12.0-2

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

感谢您的帮助.

推荐答案

似乎由py2exe构建的.exe可能缺少Canopy(EPD)随附的Intel MKL DLL.根据您拥有的Canopy(EPD)版本,NumPy DLL可能会与Intel MKL DLL链接在一起.这些DLL应该位于C:\Python27\Scripts目录中(如果在其他位置安装了EPD,则应位于相应的Scripts目录中)-查找文件名以mk2开头的DLL.

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.

上面的路径仅适用于较早的EPD版本.对于最新版本的Canopy,DLLS通常位于C:\Users\<user>\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.1.0-1371-win-x86_64\Scripts

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

这篇关于py2exe与思想和 pandas 的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-16 00:01