Question

im trying to compile my application whit py2exe, setup.py code :

from distutils.core import setup
import py2exe
import sys

if len(sys.argv) == 1:
    sys.argv.append("py2exe")

setup( options = {"py2exe": {"compressed": 1, "optimize": 2,"dll_excludes": "w9xpopen.exe", "ascii": 0, "bundle_files": 1}},
       zipfile = None,
       console = [
        {
            "script": "app.py",      
            "icon_resources": [(0, "favicon.ico")]
        }
    ],)

compilation working whitout problem, bat if try start app.exe, give this error :

F:\python\app\dist>app.exe
Traceback (most recent call last):
  File "app.py", line 8, in <module>
ImportError: No module named paramiko

line 8 off my app is this :

import paramiko

how can resolve this problem ? need compile my application whit py2exe for distribute !

Was it helpful?

Solution

You need to put import paramiko into your setup.py as well.

OTHER TIPS

This post might offer a possible approach solving the problem:

When running py2exe with a script importing Paramiko I noticed this in the output:

The following modules appear to be missing ... paramiko ...

And then in the log file created when I run the exe I saw this:

Traceback (most recent call last): ... ImportError: No module named paramiko This has to do with py2exe not being able to handle egg files. So what I did is pulled out the paramiko directory from the egg, and placed that in my site-packages directory, and then deleted the egg. It works now though the setup function still tells me this:

The following modules appear to be missing ['Crypto.PublicKey._fastmath', 'Crypto.Util.winrandom', '_ssl', 'r_hmac']

Luckily as far as I can tell, I don’t use those modules anywhere.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top