• 周一. 4月 29th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

在Linux上如何将.py转换为.exe?

[db:作者]

3月 7, 2023

我正在尝试将python文件转换为.exe文件。
问题是,我使用的是linux,我不能使用pyinstaller或cx\u freeze从中生成.exe文件
.py

有什么办法吗

我正在DebianLinux上使用Python 3.7.3

Tags:

文件pylinuxexecxfreezepyinstaller办法debianlinux1条回答网友

1楼 ·

发布于 2023-03-06 23:31:04

您应该能够使用PyInstaller创建可执行文件,因为它与Linux系统兼容:
https://pyinstaller.readthedocs.io/en/stable/requirements.html#gnu-linux

pip install pyinstaller
cd /path/to/your/program
pyinstaller  onefile yourscript.py

但是,至少对于pyinstaller,我知道无法在Linux系统上捆绑Windows的可执行文件:

The output of PyInstaller is specific to the active operating system and the active
version of Python. This means that to prepare a distribution for:

  • a different OS
  • a different version of Python
  • a 32-bit or 64-bit OS

you run PyInstaller on that OS, under that version of Python. The Python interpreter
that executes PyInstaller is part of the bundle, and it is specific to the OS and the
word size.

资料来源:https://pyinstaller.readthedocs.io/en/stable/operating-mode.html

《在Linux上如何将.py转换为.exe?》有164个想法

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注