Hoping someone can help me out, or give me an indication of whether or not what I’m trying to do is even reasonable. Some background:
I’m trying to resurrect the py2exe project. I have found it to produce significantly smaller binary distributions, especially when working with single-file or bundled distributions. Additionally, it’s ability to load libraries directly into and from memory, rather than using a temporary directory and two-pass execution makes it’s distributed versions significantly faster for repeated execution, and reduces disk over head tremendously.
Unfortunately, it does (did) not support bundling of files on 64-bit installations. I think I’ve resolved that (in fact, I know I’ve resolved that if I use VS 2008), but if I’m already rebuilding large volumes of the project from source I’d like to try to reduce the number of VC++ Redist installers I need to provide to my customers. Our products are currently built with VS 2010, so I’d like to get all of the projects I depend on building with the same compiler (a lofty goal).
So far, I’ve built my own copy of 64-bit cPython from sources, so my next step is to try to build wxPython and wxWidgets. As near I can tell, I’ve accomplished that as well - running build-wxpython.py completes as expected:
sys.argv = [‘–install’, ‘–unicode’, ‘–extra_make=TARGET_CPU=AMD64’]
wxWidgets directory is: C:\dev\wx\wxWidgets
wxWidgets build options: [‘–wxpython’, ‘–jobs=2’, ‘–unicode’, ‘–extra_make=“TARGET_CPU=AMD64”’]
creating wx/msw/setup.h from setup0.hsetting build options…
nmake.exe -f makefile.vc UNICODE=1 OFFICIAL_BUILD=1 COMPILER_VERSION=100 SHARED=1 MONOLITHIC=0 USE_OPENGL=1 USE_GDIPLUS=1 BUILD=release “TARGET_CPU=AMD64”… … <lots of compiler messages. Warnings, but no Errors> … …
Removing c:\dev\cpython\Lib\site-packages\wx-2.9.5-msw\wxPython-2.9.5.0-py2.7.egg-info
Writing c:\dev\cpython\Lib\site-packages\wx-2.9.5-msw\wxPython-2.9.5.0-py2.7.egg-infowarning: wx_install: path file ‘c:\dev\cpython\Lib\site-packages\wx-2.9.5-msw.pth’ not created
package init file ‘wx\lib\pubsub\pubsub2_init_.py’ not found (or not a regular file)
package init file ‘wx\tools\XRCed\plugins_init_.py’ not found (or not a regular file)writing list of installed files to ‘installed_files.txt’
**** c:\dev\cpython\pcbuild\amd64\python.exe -u C:\dev\wx\wxPython\distrib\makemo.py
------------ BUILD FINISHED ------------
There were a number of adjustments I had to make along the way. This change was necessary: http://wiki.wxwidgets.org/Compiling_using_MS_VC%2B%2B. I’m not certain if it’s a side-effect of using my own compiled version of Python, or if it’s related to something else on the sandbox I’m using, but I also had to manually set the os.environ[‘CPU’] value to get one of the scripts to find the correct library directory, had to manually define #_UNICODE in one of the wxWidgets projects, added a couple lines in getVisCVersion to recognize VS 2010, etc. Everything feels pretty minor (I’ll definitely submit what I think are relevant changes if I get it going fully). It’s been a slow process, but I seem to be making headway. Unfortunately though, based on what I can see, at this point I should have wx available in my python. These same steps worked when I was in the sandbox where I’m using VS2008. On my VS 2010 machine I get this when I attempt to import wx:
Traceback (most recent call last):
File “”, line 1, inFile “wx_init_.py”, line 45, in
from wx._core import *
File “wx_core.py”, line 4, in
import core
ImportError: No module named core
If I check my site-packages directory it certainly looks like core.pyd is in place:
C:\dev\cpython\Lib\site-packages\wx-2.9.5-msw>dir wx_c*
Volume in drive C has no label.
Volume Serial Number is 4457-89FADirectory of C:\dev\cpython\Lib\site-packages\wx-2.9.5-msw\wx
03/20/2013 09:27 AM 139,264 _calendar.pyd
03/20/2013 09:27 AM 226,304 _combo.pyd
03/19/2013 02:28 PM 342,163 _controls.py
03/20/2013 09:52 AM 449,642 _controls.pyc
03/20/2013 09:27 AM 1,294,336 controls.pyd03/19/2013 02:28 PM 652,451 _core.py
03/20/2013 09:52 AM 849,993 _core.pyc
03/20/2013 09:26 AM 1,462,272 core.pyd
8 File(s) 5,416,425 bytes
0 Dir(s) 65,815,478,272 bytes free
So, now I’m kind of at a loss. Not wanting to give up, I went as far as downloading the currently available binary installer for wxPython 2.8 for Python 2.7 64-bit. I had to get my custom version of python registered in Windows (this site made that easy: http://effbot.org/zone/python-register.htm), then was able to successfully install wxPython 2.8 Unicode. After doing so, attempts to import wx produce the same error.
So, that’s a ton to start off with, sorry for writing a novel. I figure it’s better to provide lots of background so you know where I’m at instead of having to go back and forth a dozen times. Thanks for reading, and thanks in advance for any advice or suggestions.
–Dan