Möchte aus einem einfachen Python Programme einer einzelnen main.py Datei eine Windows Exe-Datei erzeugen
Ich benutze dazu das Programm "Anaconda" und "PyCham"
Vorgehensweise:
1) pip install pyinstaller
2) Pfad "C:\Users\Dirk\AppData\Roaming\Python\Python311\Scripts\pyinstaller.exe" mit Variablennamen "pyinstaller" in die Systemvariablen eingetragen
3) main.py in Verzeichnis "D:\Test\" erstellt mit folgendem einfachen Code
Code: Alles auswählen
import tkinter as tk
from tkinter import ttk
def main():
window = tk.Tk()
ttk.Label(window, text="Hallo Welt").pack()
window.mainloop()
if __name__ == "__main__":
main()
Code: Alles auswählen
C:\Users\Dirk\AppData\Roaming\Python\Python311\Scripts\pyinstaller.exe --onefile main.py
Code: Alles auswählen
(base) PS D:\Test> C:\Users\Dirk\AppData\Roaming\Python\Python311\Scripts\pyinstaller.exe --onefile main.py
The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in C:\ProgramData\anaconda3\Lib\site-packages) using
conda remove
then try again.
(base) PS D:\Test>
Version geprüft und ob er überhaupt läuft
Code: Alles auswählen
(base) PS D:\Test> pip show pyinstaller
Name: pyinstaller
Version: 6.8.0
Summary: PyInstaller bundles a Python application and all its dependencies into a single package.
Home-page: https://www.pyinstaller.org/
Author: Hartmut Goebel, Giovanni Bajo, David Vierra, David Cortesi, Martin Zibricky
Author-email:
License: GPLv2-or-later with a special exception which allows to use PyInstaller to build and distribute non-free programs (including commercial ones)
Location: C:\Users\Dirk\AppData\Roaming\Python\Python311\site-packages
Requires: altgraph, packaging, pefile, pyinstaller-hooks-contrib, pywin32-ctypes, setuptools
Required-by:
(base) PS D:\Test>
Was mache ich falsch bzw. was ist nicht korrekt installiert?