我想从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
我做错了什么?
答案 0 :(得分:2)
每个版本的scipy似乎都有一组不同的bug,这些错误会导致py2exe失败。对于最新版本(0.12.0),我发现我在程序中的某处需要这两行,以便py2exe将它们包含在构建中:
from scipy.stats import futil
from scipy.sparse.csgraph import _validation
出于某种原因,似乎只是将它们放在安装脚本中的py2exe'include'选项中。