I create a script where i used this imports :
import MySQLdb
import sys
import paramiko as pm
import os
Now i try to convert this script to .exe with py2exe and this setup.py :
# setup.py
from distutils.core import setup
import os
import MySQLdb
import sys
import paramiko
import py2exe
data_files = []
setup(
name='Worker',
console=['Script.py'],
options={
'py2exe': {
'packages': [],
'dist_dir': 'dist',
'compressed': True,
'includes': ['paramiko', 'MySQLdb'],
}
},
data_files=data_files
)
Part from the Log if I run the setup :
The following modules appear to be missing
['Carbon', 'Carbon.Files', '_imp', '_scproxy', '_sysconfigdata', '_thread', 'builtins', 'cryptography.hazmat.bindings._commoncrypto', 'gssapi', 'importlib.machinery', 'pkg_resources.extern.appdirs', '
pkg_resources.extern.packaging', 'pkg_resources.extern.six', 'pkg_resources.extern.six.moves', 'sspi', 'sspicon', 'win32pipe', 'winreg']
*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.
It create a exe, but if i try to run this I get the error that the modules missing. So how I can add this modules to my exe/setup.py ?
Try Running this code:
setup.py
from distutils.core import setup
import os
import MySQLdb
import sys
import paramiko
import py2exe
data_files = []
setup(
name='Worker',
console=['Script.py'],
options={
'py2exe': {
'packages': ['Carbon', 'Carbon.Files', '_imp', '_scproxy', '_sysconfigdata', '_thread', 'builtins', 'cryptography.hazmat.bindings._commoncrypto', 'gssapi', 'importlib.machinery', 'pkg_resources.extern.appdirs', ' pkg_resources.extern.packaging', 'pkg_resources.extern.six', 'pkg_resources.extern.six.moves', 'sspi', 'sspicon', 'win32pipe', 'winreg'],
'dist_dir': 'dist',
'compressed': True,
'includes': ['paramiko', 'MySQLdb'],
}
},
data_files=data_files
)
I took the reference from this Answer.