【问题标题】:Pyinstaller isn't recognizable when trying to convert into .exe尝试转换为 .exe 时无法识别 Pyinstaller
【发布时间】:2021-04-19 01:19:29
【问题描述】:

我正在尝试使用 pyinstaller 将我使用 pygame 创建的游戏转换为 .exe 文件。由于某种原因,它不起作用。但是,它说我已经安装了它,但由于某种原因它无法重新配置。以下是一些图片:

When I try to run it using: pyinstaller --onefile -w main.py

This image is when I try to uninstall and reinstall pyinstaller. It currently says that it's installed but when I try to use the command: "pyinstaller --onefile -w main.py", it says it isn't recognized.

我真的很绝望......我已经在整个互联网上搜索了一个解决方案,但找不到一个解决方案,这是我的第一个堆栈溢出帖子。请帮忙。提前致谢!

【问题讨论】:

  • 尝试将pyinstaller添加到你的路径,你应该能够在python的脚本文件夹中找到它的文件夹,然后如果你有多个版本的python,还可以检查你使用的pip版本。跨度>

标签: python python-3.x pyinstaller


【解决方案1】:

如果 pyinstaller 与 3.9 兼容(它应该根据文档 https://pypi.org/project/pyinstaller/#:~:text=Works%20out%2Dof%2Dthe%2D,libraries%2C%20thus%20ensuring%20full%20compatibility.&text=Libraries%20like%20PyQt5%2C%20PySide2%2C%20wxPython,or%20external%20data%20files%20manually),那么请确保您运行的是带有 pyinstaller 的 python 版本。看起来你正在使用我认为没有默认 python 包的 windows(mac 安装了 2.7,这很烦人)。因此,如果您确实安装了其他 python 版本,则需要指定要运行的版本——在本例中为 3.9,因为那是在哪里。我在mac上使用的命令(我认为在windows上应该是一样的)是

/Library/Frameworks/Python.framework/Versions/3.8/bin/pyinstaller -m PyInstaller --onefile MyPythonProgram.py

第一部分是 python 安装中 pyinstaller 文件夹的位置,因此它与我的不同,但从-m 开始应该是相同的。要获取 pyinstaller 的位置,请尝试第二张图片中的目录。

【讨论】:

    猜你喜欢
    • 2021-08-12
    • 2023-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-07
    • 2021-12-24
    • 2016-08-03
    • 1970-01-01
    相关资源
    最近更新 更多