I want to make an executable file (.exe) of my Python application.
I want to know how to do it but have this in mind: I use a C++ DLL!
Do I have to put the DLL along side with the .exe or is there some other way?
py2exe can generate single file executables. see this link for examples.
The setup.py I use uses the following combination of options:
'compressed': 1,
'optimize':2,
'bundle_files': 1
I usually add external dlls (p.e. msvcr71.dll) in the same folder where the executable is.
To facilitate distribution and to automate installation after generating your exe you can use Inno Setup to create an installer that puts your exe and your dlls, and other documents (readme, etc) into the application directory
Follow These Steps: You can find this documentation in this site.
Assuming you have PIP installed in this directory c:\PythonXX\Scripts if not go to this site and see instructions on how to "Install Python Indexing Project (PIP)". Go to your command prompt and type the following command.
Go to this SITE and look for the executable named pywin32-218.win32-py2.7.exe 2.7 which is for 32 bit systems for python27 look for the one that corresponds to you. Run the executable file and it should install PyWin32 successfully which works hand in hand with pyinstaller!
Now that you have PyInstaller and PyWin32 you can start to create the single executable file. The single executable file will be created inside another folder called “dist” this folder is also created dynamically when you run the pyinstaller command. To make things clear your pyinstaller files where copied by you to another folder probably called "pyinstaller_files" folder so now type the following command in your command prompt.
The above command will create a folder called “dist” inside the pyinstaller_files folder this folder will contain your single executable file “yourscript.exe”. You can now move the single executable file somewhere of your choice and delete the “dist” & “build” folder with the “yourscript.spec” file as they are no longer needed to run your single executable file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With