2

In one of my first attempts to package my python code into a .exe file, I experience issues with packaging and running code using the scipy.weave module. When I check my warnproject.txt, I see 1324 lines of warnings (a couple of lines included below)

W: no module named numpy.negative (top-level import by scipy.weave.size_check)
W: no module named numpy.asarray (top-level import by scipy.optimize.nonlin)
W: no module named termios (top-level import by tty)
W: no module named scipy.arange (conditional import by scipy.sparse.linalg.isolve.minres)
W: no module named numpy.polyder (top-level import by scipy.signal.signaltools)
W: no module named matplotlib.rcParams (top-level import by matplotlib.figure)
etc...

First question: why do I get this many warnings whereas the program partially runs ok?

Second question: how do I import these modules in a correct manner? In my project.spec file I have written exe = EXE(..., a.binaries + [('scipy.weave', 'C:\Python27\Lib\site-packages', 'PYMODULE')], ...) but it can't find the module and will not package any file?

4

1 回答 1

1

一种方法是对 Analysis 对象使用hooks选项。这迫使分析(编译依赖项列表的人)考虑来自钩子的模块已被导入,因此是必需的。

a = Analysis(['myscript.py'], hookspath='/my/priv/hooks')

挂钩文件是简单的文本文件。

另一方面,我有很多这样的警告,我的应用程序在 linux 和 windows 上运行,没有导入相关的问题。

于 2013-03-05T15:14:43.877 回答