I'm trying to create a simple game using C++ with Python embedding. The python code is embedded in my C++ code. I used Python/C API for this. Main programm wrote on MFC. My purpose, that programm will be run on computer, where not installed Python. For this I put these files in my .exe directory:
python27.dll
Python27\
DLLs\ (contents of DLLs folder)
Lib\ (contents of Lib folder)
But I want to put these files in my .exe. It's possible? May be I can link my programm with Python together to create single .exe Read many posts, but didn't find solution...
P.S. About py2exe and etc. I know, but it is for create .exe from "clean" Python programm.
Related
I've created an executable file using cx_freeze that contains a simple Python script. The .exe file works on my PC (I have Python installed) but is it possible to send it to a colleague, for example, that doesn't have Python on their machine and will it work? The goal is to package useful Python programs and make them available for others to use even if they don't have Python.
I've played around with it a little bit and it doesn't seem to work on non-Python enabled machines. I've sent just the .exe file (didn't work), just the 'build' folder (in a zip file-didn't work) and I've even zipped the whole folder that contains the .py files and the build folder-that also didn't work. However, I thought this was the point of creating the .exe file? Any guidance would be appreciated.
Thanks
I'm unfamiliar with the terminology used for linking files into executables as they are compiled.
I want to write a Python script that extracts .icos from Windows executables that are viewable when you make file associations inside Folder Options. These are simply linked into the executable file upon compilation.
Then the script would sort the .ico files into individual folders based on their origin (it's supposed to extract all from subfolders/recursively) and even tell the difference between recently installed files and files that were left there previously.
Is there a library available that does such? Would I have to use a Python "Windows unlinker" or could I have it scan through RC resources too? Would there at least be a .DLL I can access with Python that does so?
I have a python script which I want to convert to a standalone exe file. So,I am using pyinstaller. I have 2 dll files, which are written inc and c++, and are being used in python script using ctypes.
global image_lib
image_lib = ctypes.CDLL('image_lib.dll')
global host_lib
host_lib = ctypes.CDLL('host_lib.dll')
Both the files are in the current directory. Python script runs fine. Now I convert the python script to exe using pyinstaller, and add the dlls to the same folder, it works fine in my computer. But if I copy the same exe and the dlls to a different computer, only 'image_lib.dll' will be found. For some reason the exe is not able to find host_lib.dll which is in the same directly as well.
I also tried printing the path, where it is looking for dll, using application_path = os.getcwd(), and it is the current directory, but it is not able to find the dll in this directory.
I tried to add host_lib.dll in the hidden-import while generating exe using pyinstaller, but no luck.
I don't know what the problem could be, since one the issue is with just one dll and not the other. I really need help me with this.
Thanks a lot!!
I'm trying to convert .py to .exe , but I'm not able to convert it with the help of py2exe in the command line.
I searched on the internet about a py2exe with a GUI frontend and I got the results as:
GUI2EXE (3/5) (The best one I found, but the .exe comes with lots of .dll files and the .exe file is buggy and doesn't work properly.)
H-two-O (2/5) (Waste of time. Doesn't compile any .exe files associated with Tkinter. Very creative and useful for other file formats.)
PytoEXE (1.3/5) (Just as H-two-O , but doesn't compile Tkinter files to .exe)
GP2EXE (?/5) (I didn't try it out. Maybe you can give a view on it.)
PyBuilder (2.7/5) (Reliable, good GUI interface with options but lacks some of the features and compiling speed to that of GUI2EXE.)
PythontoEXE (1.3/5) (Same as PytoEXE)
But these weren't good. I need a compiler better than all of the compilers listed above which can compile Tkinter files to .exe without any bugs.
Here's how I use py2exe. I know this isn't what you're asking for, but according to my experience, it's really annoying until it works. So please hear me out.
Assuming your Python file is called main.py.
New file setup.py (same folder):
from distutils.core import setup
import py2exe
setup(console=['main.py'])
From here, you can create a .bat file in the same folder, or run it from the command line. Either way, you'll be running python setup.py py2exe to compile the code.
I've made my first Python program, using Python 3.2. Now I'm trying to figure out how to make it an executable.
I pretty much only need it for Windows only. I've searched as much as possible and found out that py2exe doesn't support Python 3. cxfreeze does, but I can't figure out how to make a single executable of my program with it. I need it as a portable one-file exe.
Please bear with me as I am a total newcomer :) Any help is appreciated.
You can use cxfreeze to make the executable (and other files it creates), compress them into a *.7z archive using 7-zip, then use 7-ZIP SFX Maker to turn it into a self extracting archive.
When creating the SFX archive, configure it so that the main executable cxfreeze generates runs when the files are extracted. You can also change the archives icon, as well as tell the archive to extract and run from a temporary folder.
When the user runs the exe, the files will extract to the temporary folder and the program will run. To the user, it will behave exactly like a normal exe file.
According to the Python docs, the only program that will package Python3 as an .exe in cx_freeze, and the cx_freeze developer has explicitly stated that he will not support single-file executables (due to the 'dirty hacks' needed, which some anti-malware programs flag as malware).
Comment on the feature request to add Python3 support to py2exe.
You can compare py2exe folder structure with new python3, and make similar. Then you could use SFX idea to store these folders like libraries, python script and interpreter and set script for SFX to just launch your application. As I remember, this is possible in WinRar, and as I think now, in other archivers.