简体   繁体   中英

Convert a visual studio python project to one executable file

I have finished my python project and now want to transfer the project into one file, so a user can just double click it and doesn't have to compile it first. Therefore, I wanted to know if this is possible with python.

I 've read that you can convert a single python script into an executable file using pyinstaller. But in my case I have many files in different folders and I want them to be include in the executable file because otherwise the programm doesnt work.

I also tried this via the auto-pyto-exe converter ( https://github.com/brentvollebregt/auto-py-to-exe ) but I didnt got the results I wanted.

Therefore, my question is, how can I convert my visual studio python-project with many different files and folders into one executable file, so a user can just double click the file to start it?

Edit

In the other folder are also.py files like some FileImport.py or View.py. I separated these files that the whole project looks cleaner.

The Folder structure looks as follows:

-Views
---MainView
---UpdateView
---AnotherView
-Controllers
---MainViewController
---UpdateViewController
-Model
---MainModel

I found the solution. As it appears the pyinstaller can find all dependencies when you compile your script via pyinstaller myscript.py. PyInstaller creates three different folders where all necessary files are located. In the dist folder one executable is located which can be used from computers without python installed. I hope this helps somebody who has the same problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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