开发者

Error occurred when run program packed by py2exe

I packed a python program (involving PyQT4) with py2exe, the exe file run normally on my machine, but when i copy it to another machine, error occurred like following (in log file):

File "PyQt4\QtGui.pyc", line 12, in File "PyQt4\QtGui.pyc", line 10, in __load ImportError: DLL load failed:

more details:

  • i am using Python 2.5.
  • MSVCR71.dll is available in the same directorywith the exe file.

my setup.py script:

# coding: utf-8

from distutils.core import setup

import py2exe

import sys



#this allows to run it with a simple double click.

sys.argv.append('py2exe')


script = [{

    "script":"test.py", 

    'icon_resources':[(0, 'main.ico'),]

    }]



py2exe_options = {

        "includes":["sip",],

        "dll_excludes": ["MSVCP90.dll",]

        }

setup(windows=script, options={'py2exe':py2exe_optio开发者_开发百科ns})


You need to distribute the pyqt4 dlls with your exe for it to run on computers where pyqt4 is not installed. You should be able to find the dlls in something like C:\Python27\Lib\site-packages\PyQt4\bin

To package the dlls with your exe you can use an installer like nsis or inno.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜