I using pyinstaller v5.7.0
with Python 3.10.8
on Windows 11 Pro.
No ask no module named matplotlib
I think you needs to install latest pyinstaller
and Python 3.10.x version.
This my steps.
Version check on Command Prompt
>python --version
Python 3.10.8
>pyinstaller --version
5.7.0
>pip --version
pip 22.3.1 from D:\DevTools\Python\Python310\lib\site-packages\pip (python 3.10)
Code save as data.py
import matplotlib.pyplot as plt
import tkinter as tk
root=tk.Tk()
kazanım1yanlıssayısı=int(input('number'))
kazanım1bossayısı=int(input('number'))
kazanım1dogrusayısı=int(input('number'))
def buttoncall():
slices = [kazanım1bossayısı, kazanım1dogrusayısı]
cols = ['blue', 'green']
dyb = ['Boş', 'Doğru']
dyblist = list(dyb)
plt.pie(slices, labels=dyb, colors=cols)
plt.legend()
plt.show()
plt.close()
button = tk.Button(root, text='Graph', command=buttoncall)
button.pack()
root.mainloop()
Install library
pip install matplotlib
pip install pyinstaller
Create Executable by pyinstaller
pyinstaller --onefile data.py
Show logs of pyinstaller
in terminal
>pyinstaller --onefile data.py
218 INFO: PyInstaller: 5.7.0
219 INFO: Python: 3.10.8
254 INFO: Platform: Windows-10-10.0.22000-SP0
254 INFO: wrote D:\temp\answer188\data.spec
260 INFO: UPX is not available.
263 INFO: Extending PYTHONPATH with paths
...
...
37542 INFO: Updating resource type 24 name 1 language 0
37552 INFO: Appending PKG archive to EXE
37582 INFO: Fixing EXE headers
38149 INFO: Building EXE from EXE-00.toc completed successfully.
Created files
>tree /F
Folder PATH listing for volume DATA
Volume serial number is 16D6-338C
D:.
│ data.py
│ data.spec
│
├───build
│ └───data
│ │ Analysis-00.toc
│ │ base_library.zip
│ │ data.exe.manifest
│ │ data.pkg
│ │ EXE-00.toc
│ │ PKG-00.toc
│ │ PYZ-00.pyz
│ │ PYZ-00.toc
│ │ Tree-00.toc
│ │ Tree-01.toc
│ │ Tree-02.toc
│ │ warn-data.txt
│ │ xref-data.html
│ │
│ └───localpycs
│ pyimod01_archive.pyc
│ pyimod02_importers.pyc
│ pyimod03_ctypes.pyc
│ pyimod04_pywin32.pyc
│ struct.pyc
│
└───dist
data.exe
Run it ./dist/data.exe

It shows Pie chart without problem.

If you want to copy to USB, just copy data.exe
.
(without any other files copy)
Then run it by clicking from explorer
, it works
