How can I convert a .py to .exe for Python?

前端 未结 6 1074
清酒与你
清酒与你 2020-11-22 00:55

I\'m trying to convert a fairly simple Python program to an executable and couldn\'t find what I was looking for, so I have a few questions (I\'m running Python 3.6):

6条回答
  •  旧巷少年郎
    2020-11-22 01:21

    I've been using Nuitka and PyInstaller with my package, PySimpleGUI.

    Nuitka There were issues getting tkinter to compile with Nuikta. One of the project contributors developed a script that fixed the problem.

    If you're not using tkinter it may "just work" for you. If you are using tkinter say so and I'll try to get the script and instructions published.

    PyInstaller I'm running 3.6 and PyInstaller is working great! The command I use to create my exe file is:

    pyinstaller -wF myfile.py

    The -wF will create a single EXE file. Because all of my programs have a GUI and I do not want to command window to show, the -w option will hide the command window.

    This is as close to getting what looks like a Winforms program to run that was written in Python.

    [Update 20-Jul-2019]

    There is PySimpleGUI GUI based solution that uses PyInstaller. It uses PySimpleGUI. It's called pysimplegui-exemaker and can be pip installed.

    pip install PySimpleGUI-exemaker

    To run it after installing:

    python -m pysimplegui-exemaker.pysimplegui-exemaker

提交回复
热议问题