0

I am running a short (three lines) Python example (example_plot.py) with matplotlib using Windows 10 IDLE and it works fine and shows the graph. However, after compiling the example using pyinstaller and running the example_plot.exe file with the command line (CMD) the program runs for a split of a second and does not display the graph. Other programs (without matplotlib) that I wrote and compiled using pyinstaller work fine. Any help is appreciated. My example program is listed below:

import matplotlib.pyplot as plt
plt.plot(range(5))
plt.show()
2
  • You need to provide more info, does it give you some kind of output? If not.. can you add a verbose/debug flag and run it again? The program works fine (three lines, not four?). Commented Aug 10, 2021 at 21:42
  • I edited the question. Did you compile this program and made it work on a windows machine by executing the example_plot.exe file? I iwll add a debug switch adn run it again. Commented Aug 10, 2021 at 22:53

2 Answers 2

0

I reinstalled Python 3.9, matplotlib, and pyinstaller and evrything works fine. Now the program plots the graph after running the example_plot.exe file with the command line.

Sign up to request clarification or add additional context in comments.

Comments

0

A quick search on Google of pyinstaller matplotlib shows this result:

You can try to solve this problem by installing older versions of the matplotlib package. eg:
pip install matplotlib==3.2.2

Multiple other answers are available for this question, however this is the accepted answer. Please check out the page to learn more. (btw, pyinstaller is known to behave meanly with libraries such as PyQt5 and matplotlib, you can also use other packaging programs like py2exe or cx-Freeze.)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.