I have a python program MyPictures.py with following imports
import os
import gtk
from os.path import isfile, join
import shutil
import Image
I wrote following setup,py
from distutils.core import setup
import py2exe
#import os
import sys
__import__('gtk')
m = sys.modules['gtk']
gtk_base_path = m.__path__[0]
setup(
name = 'MyPictures',
description = 'Some handy tool',
version = '1.0',
windows = [
{
'script': 'MyPictures.py',
}
],
options = {
'py2exe': {
'packages':'encodings',
'includes': 'cairo, pango, pangocairo, atk, gobject,',
}
},
)
I ran
python.exe setup.py install
Output is
running install running build running install_egg_info Removing
c:\Python27\Lib\site-packages\MyPictures-1.0-py2.7.egg-info Writing
c:\Python27\Lib\site-packages\MyPictures-1.0-py2.7.egg-info
Then I ran
python.exe setup.py install
running install
running build
running install_egg_info
Removing c:\Python27\Lib\site-packages\MyPictures-1.0-py2.7.egg-info
Writing c:\Python27\Lib\site-packages\MyPictures-1.0-py2.7.egg-info
And then I ran
python.exe setup.py py2exe
running py2exe
*** searching for required modules ***
Traceback (most recent call last):
File "setup.py", line 37, in <module>
'includes': 'cairo, pango, pangocairo, atk, gobject,',
File "C:\Python27\Lib\distutils\core.py", line 152, in setup dist.run_commands()
File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command cmd_obj.run()
File "c:\Python27\lib\site-packages\py2exe\build_exe.py", line 243, in run self._run()
File "c:\Python27\lib\site-packages\py2exe\build_exe.py", line 296, in _run
self.find_needed_modules(mf, required_files, required_modules)
File "c:\Python27\lib\site-packages\py2exe\build_exe.py", line 1297, in find_needed_modules mf.import_hook(mod)
File "c:\Python27\lib\site-packages\py2exe\mf.py", line 719, in import_hook
return Base.import_hook(self,name,caller,fromlist,level)
File "c:\Python27\lib\site-packages\py2exe\mf.py", line 136, in import_hook
q, tail = self.find_head_package(parent, name)
File "c:\Python27\lib\site-packages\py2exe\mf.py", line 204, in find_head_package raise ImportError, "No module named " + qname
ImportError: No module named
How can I fix this error? This is first time I am using py2exe, thanks in advance.