I am attempting to create a exe file for an application that uses three .py files with functions and some libraries (pandas, tkinter, win32com...).
I want to create this for some people of my company. I'm using Anaconda as environment and tried auto-py-to-exe and cx_freeze to exe compilation. Some of the issues that I'm having are this:
I always need to disable windows defender or create an exeption to
the folder to run the final exe file
When I share it with my collegues in a Sharepoint folder it doesn't
work for them, it looks like some of the libraries are using paths
with my local folder.
The final folder with the exe file is very heavy (around 200MB)
including a lot of libraries that i don't need, some of the numpy
related libraries are the heaviest.
I will appreciate any help with this, I've work hard to develop the application but I can't share it to others and that is the objetive.
Thanks!
Related
I am currently working on "ubuntu 20.04". I have a classifier.py python file. My python file consists of machine learning packages like pandas, Sk learn etc. I have converted the python file (.py) into an executable file (.exe) using "Pyinstaller".
The generated .exe file works perfectly on my PC but when I try on another PC, it is depending on a path from my PC which is not present on the other PC, resulting in not working. The path is like Users/anaconda/lib etc.
Please help me, how can I solve the issue and also provide me with a good alternative like "Pyinstaller", "py2exe" etc wherein the other PC need not install the packages like Pandas, Sk Learn etc.
Is there a way that the other PC need not need even have python installed to run and executable will run along with files that the pyinstaller will create?
Advance Thankyou
I have converted a python file with seleniumto an exe using pyinstaller using this guide. I have followed the steps and have one singular exe file in the dist folder of my main project folder. My question is, how would I share this file because doesn't it depend on having selenium installed? What about the build folder in the main directory? Someone who has experience with this type of thing please can you help. I can answer any further questions in the comments, thanks.
When you use import statements in your script, PyInstaller automatically detects the modules imported and include them to the compiled EXE. It can detect a lot of modules, and selenium is between them (full list)
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 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.
Hi!I made a chess engine in python which i then compiled to .exe using py2exe. The problem is that it doesn't look very neat when i have all the strange files gathered together in the same folder (dist). I'd like to make a new folder inside the dist folder that contains all the helper files, so all my dist folder contains is the folder holding the helper files and the main launch application. However, i can't simply copy the helper files to a new folder, as the computer doesn't find them then and raises an error.
How can it be solved? Also, i'm using inno setup to make an installation, but i can't figure out how to find a solution there, either.
Thank you very much!
There is a feature in the configuration of py2exe that allows you to bundle all the Python files in a single library.zip file. That would considerably reduce the amount of files in the root directory, but there will still remain some files, regardless of all that.
These files are generally DLL files, at least from what I saw with GUI applications. You cannot remove these, because they are required to launch the application. A workaround to this problem is to create a batch file that will run the actual program which can be in child directory. The point is that these files should either be in the same directory as the executable, or the current working directory, or a path in the PATH environment variable. At least it's the case of most of these. Another approach might be a batch file which will modify the PATH variable or cd to another directory and run the file afterwards
I never tried to do it, so it might break some things for you. Anyway, IMO the best approach is to create an installer and add shortcuts and you won't have to bother with the user messing with these files.
Try using pyinstaller instead. It's easy to use, and will compile your PythonLib and all necessary python files to a stand alone EXE. So you don't have to worry about the having a mess of files in your dist file. (just one single exe).
And if you have other external files, such as databases, text files, csv's. etc... you can set them up to deploy in exactly the fashion you want from the inno setup [Files] section.
I wrote a detailed explanation on this yesterday, so check out this link:
https://stackoverflow.com/a/13259452/1339024
--Edit--
*Make sure you use pyinstaller 1.5 , as the 2.x version doesn't exactly work the same