【问题标题】:How to create an executable (.exe) Python program that also uses the PyGame library如何创建一个也使用 PyGame 库的可执行 (.exe) Python 程序
【发布时间】:2020-04-03 21:26:44
【问题描述】:

伙计们。我是 StackOverflow 和 Python 的新手。我最近使用 Python 和 PyGame 库重新创建了 Snake 游戏。问题是,我想将游戏作为可执行文件 (.exe) 发送给某人。这样当那个人收到文件时,他可以通过在他的 Windows 机器上打开“Snake.exe”来运行游戏。我只使用了 2 个 .py 文件和一个 scores.txt 文件来存储高分。我会很感激任何帮助:) 在此先感谢。

(注:我使用 PyCharm 社区编写了游戏代码)

我附上以下截图:

Files in my project folder

My game welcome screen (why not)

【问题讨论】:

    标签: python pygame exe executable


    【解决方案1】:

    我喜欢 auto_py_to_exe。使用带有pip install auto_py_to_exe 的pip 安装它。然后在命令提示符下使用python -m auto_py_to_exe 打开它。然后,您可以添加 2 个 .py 脚本、.txt 和任何其他需要的文件。 Link 到网站获取其他下载选项

    【讨论】:

      猜你喜欢
      • 2023-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-29
      • 1970-01-01
      • 2018-08-16
      相关资源
      最近更新 更多