简体   繁体   中英

Executable created by py2exe not working

I've made a GUI in wxPython and functions which use numpy and matplotlib. At first, it has asked for MSVCP90.dll. I somehow downloaded it and added to the python DLLs. Now, it generates the .exe file for the project but it doesn't work. It just opens the 'cmd' and closes down immediately. I suspect there's some problem with the project directory structure.

-- setup.py --

import py2exe, sys, os

setup(scripts=["Source\mainModule.py"],
  packages=[
    "Source",
    "Source.Packages_Needed",
    "Source.Packages_Needed.anomalyChecker",
    "Source.Packages_Needed.config",
    "Source.Packages_Needed.GUI_tools",
    "Source.Packages_Needed.parserTools",
    "Source.Packages_Needed.utilities",
    ],
  package_data={"Source.ltePackages.configuration" : ["*.txt"]},

)

-- setup.py --

-- Project Directory structure --

project/
      setup.py
      Source/
           mainModule.py
           __init__.py
           packages_Needed/
               __init__.py
               anomalyChecker/
                    __init__.py
                    ACModule1.py
                    ACModule2.py
                    ACModule3.py
               config/
                    __init__.py
                    dictionary.txt
                    reference.txt
                    configMod1.py
                    configMod2.py
                    configMod3.py
               GUI_tools/
                    __init__.py
                    analyzerGUI.py
               parserTools/
                    __init__.py
                    parser.py
               utilities/
                    __init__.py
                    plotter.py

-- Project Directory structure --

I'm running the python setup.py in the following way:

     C:\\Path\\source> python setup.py py2exe

After giving that command, I'm getting a .exe file in dist which isn't running.. it just opens a cmd and terminates immediately.

Being a newbie to python, I have two doubts :

Part - 1 of my doubt : Why is the .exe file not working ? Is there any mistake in my setup.py. If so, please point it out.

Part -2 of my doubt :

Now that, I added MSVCP90.dll . After successfully making a running .exe, Do the other system need to copy this dll into its python dlls if it runs my .exe? If so, that'll be a lot of inconvenience. Suggest a way to avoid it.

Thanks in advance.

Edit : I'm using packages : matplotlib and numpy.

i have got the same problem whith my gui on pyqt, it was resolved by including the pyqt module i was using like this

setup(windows=[{"script":"myGuy.py",
  data_files = Mydata_files,
  options={"py2exe":{"includes":["sip", "PyQt4.QtCore","PyQt4.QtGui","PyQt4.QtNetwork"],'dist_dir': "myGuiNameDir"

}})

Add the options variable and Try to replace the list with ["PyQt4.QtCore", "PyQt4.QtGui"] by the wxPython modules you are using. Let me know if it worked.

also, if u are tired of the dist directory named dist, u can use the 'dist dir' to change hi name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM