Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用pyinstaller构建python pylab/matplotlib exe_Python_Matplotlib_Pyinstaller - Fatal编程技术网

使用pyinstaller构建python pylab/matplotlib exe

使用pyinstaller构建python pylab/matplotlib exe,python,matplotlib,pyinstaller,Python,Matplotlib,Pyinstaller,以下代码运行良好,当作为解释的python py程序运行时,会显示一个简单的饼图 一个月前,我使用pyinstaller创建了一个独立的exe,效果非常好 最近,我决定重建exe。pyinstaller生成成功完成,没有错误,但生成的exe在运行时不执行任何操作。当我运行它时,它很快结束,没有任何错误,也没有显示饼图。从一个月前开始有些变化,但我不知道是什么。我尝试过卸载python和所有模块并重新安装,但没有什么不同 from pylab import * from matplotlib im

以下代码运行良好,当作为解释的python py程序运行时,会显示一个简单的饼图

一个月前,我使用pyinstaller创建了一个独立的exe,效果非常好

最近,我决定重建exe。pyinstaller生成成功完成,没有错误,但生成的exe在运行时不执行任何操作。当我运行它时,它很快结束,没有任何错误,也没有显示饼图。从一个月前开始有些变化,但我不知道是什么。我尝试过卸载python和所有模块并重新安装,但没有什么不同

from pylab import *
from matplotlib import pyplot as plt

figure(1, figsize=(6,6))
ax = axes([0.1, 0.1, 0.8, 0.8])

labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [15, 30, 45, 10]
explode=(0, 0.05, 0, 0)

pie(fracs, explode=explode, labels=labels,
                autopct='%1.1f%%', startangle=90)

title('Pie Chart Example', bbox={'facecolor':'0.8', 'pad':5})

show()
这是我用来构建exe的pyinstaller命令。此命令适用于其他pyqt gui构建及其exe的正常工作。我只是在构建pylab/matplotlib python代码时遇到问题

c:/python27/python.exe c:/pyinstaller/pyinstaller.py --noconfirm --noconsole --onefile --icon=pie.ico pie.py

找到了解决办法。显然,我的pyinstaller版本中有一个bug。在pyinstaller的网站上找到此帖子:

所以我下载了最新的pyinstaller,我可以再次构建我的piechart python程序的exe