【发布时间】:2015-12-18 02:01:13
【问题描述】:
我在使用 cx_freeze 和 scipy 编译 exe 时遇到问题。特别是,我的脚本使用
from scipy.interpolate import griddata
构建过程似乎成功完成,但是当我尝试运行已编译的 exe 时,我收到以下消息。
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
exec(code, m.__dict__)
File "gis_helper.py", line 13, in <module>
File "C:\Python27\lib\site-packages\scipy\__init__.py", line 103, in <module>
raise ImportError(msg)
ImportError: Error importing scipy: you cannot import scipy while
being in scipy source directory; please exit the scipy source
tree first, and relaunch your python intepreter.
查看scipy\_init__.py文件后,有以下内容:
if __SCIPY_SETUP__:
import sys as _sys
_sys.stderr.write('Running from scipy source directory.\n')
del _sys
else:
try:
from scipy.__config__ import show as show_config
except ImportError:
msg = """Error importing scipy: you cannot import scipy while
being in scipy source directory; please exit the scipy source
tree first, and relaunch your python intepreter."""
raise ImportError(msg)
我不完全确定这里的问题是什么,尽管似乎由于 scipy 配置文件存在问题而引发了错误。可能不包含在构建过程中。我是个新手,希望在使用 cxfreeze 生成构建方面更有经验的人可以对此有所了解。
顺便说一句,正在使用的 scipy 是从二进制文件 here 安装的。
【问题讨论】: