Frage

The following code runs fine and displays a simple pie chart when run as an interpreted python py program.

A month ago, I used pyinstaller to create a stand-alone exe and that worked great.

Recently, I decided to rebuild the exe. The pyinstaller build completes successfully without errors, but the generated exe does nothing when run. When I run it, it ends quickly without any errors and without displaying a pie chart. Something has changed since a month ago, but I can't figure out what. I've tried uninstalling python and all modules and reinstalling, but that made no difference.

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()

This is the pyinstaller command I am using to build the exe. This command works for other pyqt gui builds and their exe's work fine. I am only having a problem building pylab/matplotlib python code.

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

Lösung

Found the solution. Apparently there was a bug in the version of pyinstaller I had. Found this post on pyinstaller's site: http://www.pyinstaller.org/ticket/651

So I downloaded the latest pyinstaller and I can build an exe of my piechart python program again!

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top