从Python到EXE文件的一个文件 [英] Python to EXE file in one file
问题描述
到目前为止,我已经使用cx_freeze将.py文件转换为.exe文件,但是我得到了很多文件.有没有办法将所有内容整合到一个可执行文件中?
So far I have used cx_freeze to convert .py file to .exe file, but I get many files. Is there a way to get it all into one executable?
我已经看到PyInstallerGUI能够做到这一点,但是它适用于Python 2.7.也可以使用Python 3.4吗?
I have seen that PyInstallerGUI is able to that, but it is for Python 2.7. Can it be done with Python 3.4 as well?
推荐答案
PyInstaller可以在Python 3.5上运行.安装后(在终端机pip install pyinstaller
中键入),可以在终端机中进行操作:
PyInstaller works up to Python 3.5. Once you've installed it (type in your terminal pip install pyinstaller
), you can do in your terminal:
pyinstaller --onefile script.py
其中script.py
是要编译为.exe的脚本的名称
where script.py
is the name of script you want to compile into .exe
使用--onefile
选项将仅创建一个.exe文件.
With the --onefile
option it will create only one .exe file.
这篇关于从Python到EXE文件的一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!