【问题标题】:How do I make a Python program into a Windows app?如何将 Python 程序制作成 Windows 应用程序?
【发布时间】:2020-08-18 11:16:52
【问题描述】:

我想将一个 python 程序变成一个 Windows 10 或 7 应用程序,可以在没有安装 python 的 Windows PC 上运行。我使用 python 3.7。

我认为这并不重要,但以防万一,这是我的代码:

from tkinter.messagebox import showwarning
from tkinter import *
import schedule
from win10toast import ToastNotifier
toaster = ToastNotifier()


root = Tk()
root.withdraw()

def shownotification():
    toaster.show_toast("Screen Time",
                   "Take a break for 20 seconds",
                   duration=5)


schedule.every(20).minutes.do(shownotification)

while True:
    schedule.run_pending()

【问题讨论】:

  • 您用py2exe 标记了您的问题。你试过使用那个程序吗?还是别的什么?
  • 搜索 python to exe - 大量的howtos
  • 我试过py2exe但效果不佳

标签: python python-3.x windows executable py2exe


【解决方案1】:

你需要 pyinstaller 和 pip

这里是pip下载链接:https://pip.pypa.io/en/stable/installing/

打开您的终端并转到您的 python 文件所在的同一目录。

然后继续输入pyinstaller filename.py

您可以尝试其他可以使您的应用成为图标的命令,以及此视频中的其他内容:

https://www.youtube.com/watch?v=lOIJIk_maO4

【讨论】:

    猜你喜欢
    • 2011-11-07
    • 2016-10-25
    • 1970-01-01
    • 2015-07-08
    • 2011-01-07
    • 2011-08-02
    • 2012-04-17
    • 1970-01-01
    • 2015-04-29
    相关资源
    最近更新 更多