简体   繁体   中英

Python/C API project - compile to exe

I'm working on project where I am using Python/C API and C++. C++ is used for most part of application, mainly for gui (wxWidgets), while Python is used for calculations on large data sets, eg from files. I'm doing it in Visual Studio and when I run the project in IDE everything works fine, like I want it to. Also, the exe file that is created during the launch of the project in the visual studio, when it is in the same folder with the python.py file, also works as it should be. But what I want to achieve is a complete application contained in one exe.

While searching for a solution, I found various possibilities to create an exe from a python file. For example, PyInstaller which I tested for a simple "hello world" python file and it works. However, I don't know and can't find a solution how to combine the exe created in visual with a python file.

In PyInstaller github issues I found that line:

pyinstaller App.py --add-data 'pathtoexe\your.exe;.' --add-binary "pathtodll\your.dll;." --onefile --noconsole --clean

And I typed this into the console:

pyinstaller myPythonFile.py --add-data 'myVisualGeneratedFile.exe;.' --onefile --noconsole --clean

But after that, when I clicked generated exe file, nothing happens.

I hope that someone has done a similar thing before and I can find help here because I'm already losing my mind on it.

According to https://pyinstaller.readthedocs.io/en/stable/usage.html , you should use --add-binary and not --add-data .

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