Creating python pylab / matplotlib exe using pyinstaller

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

A month ago, I used pyinstaller to create a standalone exe and worked fine.

I recently decided to rebuild exe. The pyinstaller build succeeds without errors, but the generated exe does nothing at startup. When I run it, it ends quickly without any errors and without displaying a pie chart. Something has changed since that month ago, but I can’t understand that. I tried uninstalling python and all modules and reinstalling, but that didn't make any 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()

pyinstaller, exe. pyqt gui, exe . pythab/matplotlib python.

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

. , pyinstaller . pyinstaller: http://www.pyinstaller.org/ticket/651

, pyinstaller, exe piechart python!

+1

Source: https://habr.com/ru/post/1615435/


All Articles