简体   繁体   English

如何将 Python 文件转换为 .exe 文件?

[英]How can I convert a Python file to a .exe file?

I've seen many options online, but none of them seem to support Python 3.8.我在网上看到了很多选项,但似乎没有一个支持 Python 3.8。 Is there any way to convert a python project to a .exe anymore?有没有办法将python项目转换为.exe? If so, how can I do that?如果是这样,我该怎么做?

EDIT: I've tried PyInstaller multiple times, both before it was recommended here and afterwards, but I keep getting huge error messages that I don't know how to make sense of.编辑:我已经多次尝试 PyInstaller,无论是在推荐这里之前还是之后,但我不断收到大量错误消息,我不知道如何理解。

Use pyinstaller .使用pyinstaller

Example: pyinstaller yourfile.py -F --onefile示例: pyinstaller yourfile.py -F --onefile

This will turn your code into a .exe file on Windows.这会将您的代码转换为 Windows 上的.exe文件。

To install PyInstaller, you simply use pip, thus pip install PyInstaller or pip3 install PyInstaller .要安装 PyInstaller,您只需使用 pip,即pip install PyInstallerpip3 install PyInstaller

You can also make sure you have the latest development version of pyinstaller: pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz您还可以确保您拥有最新的 pyinstaller 开发版本: pip install https://github.com/pyinstaller/pyinstaller/archive/develop.tar.gz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM