目前我面临着一个关于scipy和cx-Freeze的问题。
Windows 7 Enterprise (64-Bit);
Python 3.5.2|Anaconda 4.2.0 (64-bit);
scipy 0.18.1;
cx-Freeze 5.0.1;我想将python脚本冻结为可执行文件。下面你可以找到源代码和freeze脚本。
main.py
import scipy
if __name__ == '__main__':
print('Test dirstribution methods!')这就是main.py文件。
setup.py
import sys
from cx_Freeze import *
packages = ['numpy']
excludes = ['tkinter']
distTest_Target = Executable(
script = "main.py",
base = "Console",
shortcutName="distTest",
targetName = "distTest.exe"
)
build_exe_options = {
"packages": packages,
"excludes":excludes
}
setup(name='distTest',
version='1.0.0',
description='distTest (64-bit)',
options = {"build_exe": build_exe_options},
executables=[distTest_Target]
)构建过程执行时没有错误,但是如果我尝试启动exe,我得到以下错误:Figure: Error during execution of exe
如果我尝试将'scipy‘添加到包列表中,比如packages = ['numpy','scipy'],我会在构建过程中得到另一个错误:Figure: scipy ImportError。
有没有人知道哪里出了问题?提前感谢您的帮助!
发布于 2017-03-15 15:38:14
安装最新版本的Anaconda (4.3.1),并在cx_freeze包中编辑hooks.py:
finder.IncludePackage("scipy.lib")替换为:
finder.IncludePackage("scipy._lib")解决了这个问题。
https://stackoverflow.com/questions/42759262
复制相似问题