|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
PY2EXE step-by-step guide
People seem to have lots of problems with py2exe, I hope this helps:
py2exe guide As this is fresh out off the press there maybe bugs - so any comments are appreciated. grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#2
|
|||
|
|||
|
The step-by-step guide was very clear and simply put!
Good one!!!! Subha ![]() |
|
#3
|
||||
|
||||
|
Like it Grim!
That is if you hadn't guessed by the fact that I've stuck this thread to the top of the forum [for the time being] . Anyway, one trivial thing I would add is an alternative way to get the command prompt/DOS prompt under Windows,Quote:
This isn't really that important... just a personal preference really and very handy little thing to know in general . Very cool!Mark. |
|
#4
|
|||
|
|||
|
another thing to keep in mind is that you can get to Run Dialog very fast using: Window Button+R
because using the mouse sucks.
__________________
Jack --------- use code tags become vegetarian python? yes, sir! unarm.org get firefox If I helped you then please click the " " in the upper right-hand corner of my post.
|
|
#5
|
|||
|
|||
|
Another good py2exe resource
This has helped me a number of times
PY2exe wiki http://starship.python.net/crew/theller/moin.cgi/Py2Exe |
|
#6
|
||||
|
||||
|
Quote:
Yep - everything you need is already described on the official py2exe website and wiki. But - based on the number of forum posts it is clear that people don't get it ![]() My aim was to illustrate few basics such as: * Python code is stored as modules and they are text files * Setup.py is separate from the module you want to compile * Create a workspace directory * Use a DOS box to run Python These seem to be the things that first timers don't quite get and yet the tools they want to use assume these things are already understood. grimey |
|
#7
|
|||
|
|||
|
Using Py2exe with Python Imaging Library (PIL )
Using Py2exe with Python Imaging Library (PIL )
Creating standalone windows executables on widows using is py2exe is pretty straight forward . But you might sometime run into unexpected problems like You might get the follwing errors while running the exe file created by the py2exe 1 . LookupError: no codec search functions registered: can't find encodingsolution : explicitly include the encodings package: like this : python setup.py py2exe -p encodings Un located modules *are* normal. A lot of modules have conditional imports of other modules that they don't really *need*. This means py2exe tries to include them in case they are needed. This sometimes means you have more modules than you really need - and also reports of modules that can't be found. 2 . Include the PIL switch on the py2exe line The py2exe line needs to be: python setup.py py2exe -p encodings –pPIL It worked for me even without that switch use that in case u run into problems . 3 . File "Image.pyc", line 1571, in open IOError: cannot identify image file Solution : In order to make PIL and PY2EXE work together all libraries of PIL need to be imported explicitly such as: import Image import BmpImagePlugin # if you are using bitmaps Import JpgImagePlugin # if you are dealing with jpg images So forth .. Note : These explicit imports may not be necessary if you are running the python script directly but are needed if you are running the exe file created by py2exe . |
|
#8
|
|||
|
|||
|
awesome man
![]() |
|
#9
|
|||
|
|||
|
you legend! i've been trying to get py2exe to work all day!
|
|
#10
|
|||
|
|||
|
This may be a dumb question, but is there a way to make an installer for the files generated by py2exe?
|
|
#11
|
||||
|
||||
|
Quote:
Not a dumb question at all ![]() I use the excellent INNO Setup which seems to handle everything I need. grim ![]() |
|
#12
|
|||
|
|||
|
Excellent. I tried it using the example setup.py that came with py2exe for use with INNO and it worked almost perfectly except for a dll that somehow didn't get linked. I have to investigate further for what may have happened, it was msvcr71.dll. Thanks for the tip and clean tut.
|
|
#13
|
||||
|
||||
|
I have modified Paul Hardwick's code when using Py2Exe with wxPython to avoid the codec LookupError when you run the exe file.
Code:
# run this code to create a windows exe file
# save in the working directory where your code file is
# and run the program from there
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
# usually needed for wxPython code to prevent the
# "LookupError: no codec search functions registered" when you run the exe
opt = {"py2exe": {"packages": ["encodings"]}}
# insert your own code filename here ...
setup(options = opt, windows = [{"script": 'myCodeFile.py'}])
|
|
#14
|
|||
|
|||
|
FYI--new py2exe version released --0.6.2
The new version has a nifty option that can allow you to create a fast standalone executable. Other installer packages usually unzip the exe into a temp dir and run it from there. The py2exe implementation does not.
You can bundle all of the files into a "Library.zip" and have a small executable, or bundle all into one .exe . To create one large exe,simply add the line Code:
zipfile=None Then from the command line, call Code:
python setup.py py2exe --bundle 1 The bundle 2 option, also does a little less bundling. |
|
#15
|
||||
|