2

我想从 pyqtgraph 创建一个可执行文件,

最后我尝试了这个教程

http://www.pyqtgraph.org/Bundling%20applications%20with%20PyQtGraph_R16.pdf

在示例中的编译代码第一次运行之后,教程说应该有一个错误消息,比如

Traceback (most recent call last):
File "simpleApp.pyw", line 6, in <module>
File "pyqtgraph\__init__.pyc", line 107, in <module>
File "pyqtgraph\__init__.pyc", line 89, in importAll
WindowsError: [Error 3] The system cannot find the path specified:
'D:\\xxxxxx\\SandBox\\src\\dist\\library.zip\\pyqtgraph\\graphicsItems/*.*'

但我明白了

 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 246, in <module>
 File "scipy\stats\distributions.pyc", line 16, in <module>
 File "scipy\optimize\__init__.pyc", line 148, in <module>
 File "scipy\optimize\_root.pyc", line 20, in <module>
 File "scipy\optimize\nonlin.pyc", line 122, in <module>
 File "scipy\sparse\__init__.pyc", line 193, in <module>
 File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
 File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path                
 (scipy\sparse           \csgraph\_shortest_path.c:14224)
 ImportError: No module named _validation
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\HistogramLUTItem.pyc", line 10, in <module>
 File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
 File "pyqtgraph\colormap.pyc", line 2, in <module>
 File "scipy\interpolate\__init__.pyc", line 160, in <module>
 File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
 File "scipy\interpolate\interpnd.pyc", line 12, in <module>
 File "scipy\interpolate\interpnd.pyc", line 10, in __load
 File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
 File "scipy\spatial\__init__.pyc", line 87, in <module>
 File "scipy\spatial\kdtree.pyc", line 8, in <module>
 File "scipy\sparse\__init__.pyc", line 193, in <module>
 File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
 File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse   
 \csgraph\_shortest_path.c:14224)
 ImportError: No module named _validation
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\GraphicsLayout.pyc", line 6, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
 File "pyqtgraph\colormap.pyc", line 2, in <module>
 File "scipy\interpolate\__init__.pyc", line 160, in <module>
 File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
 File "scipy\interpolate\interpnd.pyc", line 12, in <module>
 File "scipy\interpolate\interpnd.pyc", line 10, in __load
 File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
 File "scipy\spatial\__init__.pyc", line 87, in <module>
 File "scipy\spatial\kdtree.pyc", line 8, in <module>
 File "scipy\sparse\__init__.pyc", line 193, in <module>
 File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
 File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse   
 \csgraph\_shortest_path.c:14224)
 ImportError: No module named _validation
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 177, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\graphicsItems\ScatterPlotItem.pyc", line 7, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 178, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\widgets\PlotWidget.pyc", line 10, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 178, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\widgets\GradientWidget.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
 File "pyqtgraph\colormap.pyc", line 2, in <module>
 File "scipy\interpolate\__init__.pyc", line 160, in <module>
 File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
 File "scipy\interpolate\interpnd.pyc", line 12, in <module>
 File "scipy\interpolate\interpnd.pyc", line 10, in __load
 File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
 File "scipy\spatial\__init__.pyc", line 87, in <module>
 File "scipy\spatial\kdtree.pyc", line 8, in <module>
 File "scipy\sparse\__init__.pyc", line 193, in <module>
 File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
 File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse   
 \csgraph\_shortest_path.c:14224)
 ImportError: No module named _validation
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 178, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\widgets\GraphicsLayoutWidget.pyc", line 2, in <module>
 File "pyqtgraph\graphicsItems\GraphicsLayout.pyc", line 6, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 178, in <module>
 File "pyqtgraph\__init__.pyc", line 167, in importAll
 File "pyqtgraph\__init__.pyc", line 159, in importModules
 Traceback (most recent call last):
 File "pyqtgraph\__init__.pyc", line 155, in importModules
 File "pyqtgraph\widgets\HistogramLUTWidget.pyc", line 8, in <module>
 File "pyqtgraph\graphicsItems\HistogramLUTItem.pyc", line 10, in <module>
 File "pyqtgraph\graphicsItems\GradientEditorItem.pyc", line 8, in <module>
 File "pyqtgraph\colormap.pyc", line 2, in <module>
 File "scipy\interpolate\__init__.pyc", line 160, in <module>
 File "scipy\interpolate\ndgriddata.pyc", line 10, in <module>
 File "scipy\interpolate\interpnd.pyc", line 12, in <module>
 File "scipy\interpolate\interpnd.pyc", line 10, in __load
 File "interpnd.pyx", line 1, in init scipy.interpolate.interpnd (scipy\interpolate\interpnd.c:22803)
 File "scipy\spatial\__init__.pyc", line 87, in <module>
 File "scipy\spatial\kdtree.pyc", line 8, in <module>
 File "scipy\sparse\__init__.pyc", line 193, in <module>
 File "scipy\sparse\csgraph\__init__.pyc", line 148, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 12, in <module>
 File "scipy\sparse\csgraph\_shortest_path.pyc", line 10, in __load
 File "_shortest_path.pyx", line 18, in init scipy.sparse.csgraph._shortest_path (scipy\sparse   
 \csgraph\_shortest_path.c:14224)
 ImportError: No module named _validation
 Traceback (most recent call last):
 File "pyqtgraph_test.pyw", line 8, in <module>
 File "pyqtgraph\__init__.pyc", line 180, in <module>
 File "pyqtgraph\imageview\__init__.pyc", line 6, in <module>
 File "pyqtgraph\imageview\ImageView.pyc", line 20, in <module>
 File "pyqtgraph\imageview\ImageViewTemplate_pyqt.pyc", line 159, in <module>
 File "pyqtgraph\widgets\PlotWidget.pyc", line 10, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
 File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
 File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
 File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
 File "scipy\stats\__init__.pyc", line 320, in <module>
 File "scipy\stats\stats.pyc", line 245, in <module>
 ImportError: cannot import name futil

我究竟做错了什么 ?

4

1 回答 1

2

每个版本的 scipy 似乎都有一组不同的错误导致 py2exe 失败。对于最新版本(0.12.0),我发现我的程序中需要这两行,以便 py2exe 将它们包含在构建中:

from scipy.stats import futil
from scipy.sparse.csgraph import _validation

出于某种原因,将这些简单地放在安装脚本中的 py2exe 'includes' 选项中似乎不起作用。

于 2013-07-12T11:32:53.893 回答