开发者

py2exe can't find modules

I have a python project with many modules and dire开发者_Python百科ctories.The main program to run is test_main.py:

    import PSI_Core.benchManager as bm
    import shutil
    import os

    manager = bm.benchManager();

I follow exacty the procedure for py2exe to create an exe file for this project.But once the exe file is created and I run it , it gives error :

    ImportError: No module named PSI_Core.benchManager

Has anybody any experience with py2exe ? Success ?


I know this isn't a direct answer but after half an hour of trying to get py2exe working, I gave up and tried cx_Freeze which works wonderfully:

http://cx-freeze.sourceforge.net/cx_Freeze.html

Within five minutes, I had a shiny executable waiting for me :-)


I have some experience with py2exe, but most of it is not being able to find a proper fix to my problems and resorting to workarounds and patches. However, there is a good chance that your problem is relatively simple. If py2exe can't find the module, I suggest you use the setup script to manually include a module. Here is an example of what it should look like:

setup(
    options = {'py2exe': {'includes': "PSI_Core"}},
    windows = [{'script': "test_main.py"}]
)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜