Search code examples
pythonpippy2exedistutils

python 3.4 py2exe is not working or doing anything


I am trying to run a python file that I create as an executable or .exe in windows. I want to run this code in another computer that does not have nor need python, or pyserial or PIL or any other software, My code creates a Gui that do stuff

I am using a method to do this but it is not working

first I create a new python file, called setup.py, inside I put this code

from distutils.core import setup
import py2exe

setup(console=['mycode.py'])

and mycode.py is where my code creates a GUI that do stuff

of course I have downloaded the py2exe application by typing in the command prompt

pip install py2exe

then in the command prompt I change the directory where my setup.py and mycode.py are and run this line

python setup.py py2exe

and effectively it do creates 2 folders, one with pycache (with one archive mycode.cpython-34.pyc) and another one with a lot of archives and mycode.exe

then I take these to folders from my computer to another computer where python, pyserial, PIL are not installed, and I try to run mycode.exe and it's not working. Could someone explain why?


Solution

  • I have found the problem, there is no problem with py2exe but with mycode

    in mycode I use some images from my computer so when I create the .exe it takes those images from the directory in my computer and runs

    but when I take the .exe from my computer to another computer to run it, I do not take those images and therefore the .exe does not run

    now the problem is how to call these images, which is another question