简体   繁体   English

从几个 .py 和 .svg 文件创建一个 EXE 文件

[英]Create an EXE file from several .py and .svg files

hello i have a question about creating exe files.你好我有一个关于创建 exe 文件的问题。

I have a python file named main.py.我有一个名为 main.py 的 python 文件。 Furthermore, this main.py needs another file functions.py and two files with the names svg1.svg and scg2.svg.此外,这个 main.py 需要另一个文件 functions.py 和两个名为 svg1.svg 和 scg2.svg 的文件。

Now I want to convert this program to an.exe.现在我想将此程序转换为 an.exe。 so far I've only changed individual.py files.到目前为止,我只更改了 individual.py 文件。 Unfortunately I did not find anything on the internet about how to create an.exe from several.py files and.svg files.不幸的是,我在互联网上没有找到任何关于如何从几个 .py 文件和 .svg 文件创建 an.exe 的信息。

Can anyone tell me what tool to do this with?谁能告诉我用什么工具来做这个?

Edit:I took this command to include my two svg files.编辑:我使用这个命令来包含我的两个 svg 文件。 Python_KuKa is my folder in which all files are located. Python_KuKa 是我所有文件所在的文件夹。

pyinstaller --onefile main.py \ --add-data Python_KuKa/_SVG_KuKa_P.svg;funktionen.py\ --add-data Python_KuKa/_SVG_Kurbelschema_Leer_Rotate.svg;funktionen.py

However, when I do this, the error occurs:但是,当我这样做时,会发生错误:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\'

So what is my mistake?那么我的错误是什么?

You can use pyinstaller python library to convert python file to exe file.您可以使用 pyinstaller python 库将 python 文件转换为 exe 文件。 and you can also convert directory of related files to.exe using PyInstaller.您还可以使用 PyInstaller 将相关文件的目录转换为 .exe。

You can read more from here: https://pypi.org/project/PyInstaller/您可以从这里阅读更多信息: https://pypi.org/project/PyInstaller/

There is also an alternative way using buildozer:还有另一种使用 buildozer 的方法:

https://buildozer.readthedocs.io/en/latest/ https://buildozer.readthedocs.io/en/latest/

you can also see this Build Multiple.py files into a single executable file using pyinstaller您还可以使用 pyinstaller 将此 Build Multiple.py 文件转换为单个可执行文件

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

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