Here is what worked for me with Python 2.7 Win32. I've used the cefsimple.py example from the cefpython's example folder for demonstration. You need win32gui module for this example to work so install this first.
- Downloaded and installed the cefpython1 pacakage.
- Copied cefsimple.html, cefsimple.py, cefwindow.py and icon.ico from cefpython's example directory into a separate directory and altered cefsimple.py to simply import cefpython as
from cefpython1 import cefpython
. The __file__
based module detection is not working inside py2exe and causes errors so I've removed it (maybe there's a better way around).
- Created the following setup.py in the folder containing the above files copied:
from setuptools import setup
import py2exe
import os
def get_cefpython_path():
import cefpython1 as cefpython
path = os.path.dirname(cefpython.__file__)
return "%s%s" % (path, os.sep)
def get_data_files():
cefp = get_cefpython_path()
data_files = [('', [
'%s/icudt.dll' % cefp,
'%s/d3dcompiler_43.dll' % cefp,
'%s/d3dx9_43.dll' % cefp,
'%s/devtools_resources.pak' % cefp,
'%s/ffmpegsumo.dll' % cefp,
'%s/libEGL.dll' % cefp,
'%s/libGLESv2.dll' % cefp,
'%s/Microsoft.VC90.CRT.manifest' % cefp,
'%s/msvcm90.dll' % cefp,
'%s/msvcp90.dll' % cefp,
'%s/msvcr90.dll' % cefp,
'icon.ico', 'cefsimple.html']),
('locales', ['%s/locales/en-US.pak' % cefp]),
]
return data_files
setup(
data_files = get_data_files(),
windows=['cefsimple.py'],
options={
"py2exe": {
"includes": ["json", "urllib"]
}
}
)
- Then just simply run py2exe as follows in the directory:
python setup.py py2exe
- You can now run the generated application with
dist/cefsimple.exe
You can get the files for this example from my Google Drive.