Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

python - py2exe fails to generate an executable

I am using python 2.6 on XP. I have just installed py2exe, and I can successfully create a simple hello.exe from a hello.py. However, when I try using py2exe on my real program, py2exe produces a few information messages but fails to generate anything in the dist folder.

My setup.py looks like this:

from distutils.core import setup
import py2exe

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

and the py2exe output looks like this:

python setup.py py2exe
running py2exe
creating C:DevSourceScriptsServerManageruild
creating C:DevSourceScriptsServerManageruilddist.win32
   ...
   ...
creating C:DevSourceScriptsServerManagerdist
*** searching for required modules ***
*** parsing results ***
creating python loader for extension 'wx._misc_' (C:Python26libsite-packageswx-2.8-msw-unicodewx\_misc_.pyd -> wx._misc_.pyd)
creating python loader for extension 'lxml.etree' (C:Python26libsite-packageslxmletree.pyd -> lxml.etree.pyd)
   ...
   ...
creating python loader for extension 'bz2' (C:Python26DLLsz2.pyd -> bz2.pyd)
*** finding dlls needed ***

py2exe seems to have found all my imports (though I was a bit surprised to see win32 mentioned, as I am not explicitly importing it). Also, my program starts up quite happily with this command:

python ServerManager.py

Clearly I am doing something fundamentally wrong, but in the absence of any error messages from py2exe I have no idea what.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I put this in all my setup.py scripts:

distutils.core.setup(
    options = {
        "py2exe": {
            "dll_excludes": ["MSVCP90.dll"]
        }
    },
    ...
)

This keeps py2exe quiet, but you still need to make sure that dll is on the user's machine.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...