I want to generate for Windows platform the executable file of my Python GUI application.
- I'm using two .py OO scripts
- The first script (processcls.py) contains this header:
from lxml import html
from urllib import urlopen
import os, re, sys, time
- The second script contains this header:
from processcls import *
from Tkinter import *
import Queue, threading, tkFileDialog, ttk, tkMessageBox, win32clipboard
- And this is my py2exe script. The problem is that I can't see any GUI created. So I don't clear know where is my mistake in the code.
from distutils.core import setup
import py2exe
setup(
name='MyApplic',
author='amazon',
author_email='[email protected]',
windows=[
{
'script':"init.py",
'uac_info': "requireAdministrator","icon_resources": [(1, "favicon.ico")]
}
],
options=
{
'py2exe':{
'includes': ['lxml.etree', 'lxml._elementpath', 'gzip', 'processcls'],
'packages': ['lxml', 'urllib', 'Tkinter'],
'bundle_files': 1,
'compressed' : True
}
},
zipfile = None
)
Any suggestions? I'm using Tkinter as a GUI gramework and Python 2.7
Thanks Migrome
2 Answers 2
go to cmd and type
pip install auto-py-to-exe
wait until it finishes, and then, run
auto-py-to-exe
on cmd. A GUI should appear. Follow the instructions given.
Comments
All credits to https://www.youtube.com/watch?v=OZSZHmWSOeM
If you are unable to run the pip command, follow this guide:
- Download this zip: https://github.com/brentvollebregt/auto-py-to-exe
- Extarct the zip file.
- In the cmd, browse to the main folder of the program, in my case C:\Program Files\auto py to exe:
cd C:\Program Files\auto py to exe
- Install the repository using this command (continue in the cmd):
pip install -r requirements.txt
- When finished, run the run.py file from the same folder or just type in the cmd: (Tip: Create a shortcut for this file to the desktop for future usage!)
python run.py
An "Auto Py To Exe" GUI should appear in the screen.
Select your .py file or paste the path on "Script Location"
Select One File mode.
If you are using a GUI like Tkinter, select "Window Based (Hide the console)". If not, select "Console Based"
Select an icon if you want and select additional files if the code has external files.
In "Advanced", select the output folder.
Click on the "CONVERT .PY TO .EXE" BUTTON. When the process has finished, you'll have a .exe file in your output folder. Execute-it. It should work exactly as the .py other.
Comments
Explore related questions
See similar questions with these tags.
python setup.py py2exeare there any errors?