How to generate python exe from python script, including other python scripts

I am trying to create an exe for python script "cnss_image_loader.py" that imports other python scripts into the same folder (see below), now I am trying to generate "cnss_image_loader.exe" using the python setup.py py2exe (see the conclusion is below) and the errors below are executed, they are not sure if they are a real problem or not, but when the generated exe starts, it gives the errors shown below

Question:

1. Can I use py2exe to generate an executable?

2. Can someone point out exactly what I am missing and provide a guide for generating exe?

3. Is there a better way to generate python executable?

ERROR: -

 C:\Dropbox\py2exe\dist>cnss_image_loader.exe Traceback (most recent call last): File "cnss_image_loader.py", line 9, in <module> File "android_dl.pyc", line 2, in <module> File "pip\__init__.pyc", line 14, in <module> File "pip\utils\__init__.pyc", line 22, in <module> File "pip\compat\__init__.pyc", line 26, in <module> ImportError: No module named ipaddr 

Directory structure: - py2exe

cnss_image_loader.py

 from android_dl import * from alpaca import * 

setup.py

 from distutils.core import setup import py2exe setup(console=['cnss_image_loader.py']) 

python setup.py py2exe

 The following modules appear to be missing ['Carbon', 'Carbon.Files', 'ElementC14N', 'OpenSSL.SSL', 'Pyrex.Distutils.build_ext', '_frozen_importlib', '_imp', '_manylinux', '_posixsubprocess', '_scproxy', '_sysconfigdata', 'backports.ssl_match_hostname', 'builtins', 'certifi', 'charade.universaldetector', 'chardet', 'chardet.universaldetector', 'configparser', 'datrie', 'genshi.core', 'html', 'html.entities', 'html.parser', 'http', 'http.client', 'http.cookies', 'importlib.machinery', 'importlib.util', 'ipaddr', 'ipaddress', 'java', 'lxml', 'lxml.etree', 'lzma', 'ndg.httpsclient.ssl_peer_verification', 'ndg.httpsclient.subj_alt_name', 'ordereddict', 'packages.six.moves', 'packages.ssl_match_hostname.CertificateError', 'packages.ssl_match_hostname.match_hostname', 'packages.urllib3.util.Timeout', 'packages.urllib3.util.parse_url', 'pip._vendor.six.moves.urllib', 'pyasn1.codec.der', 'pyasn1.type', 'queue', 'redis', 'reprlib', 'serial', 'serial.tools.list_ports', 'serializer.serialize', 'simplejson', 'sitecustomize', 'socks', 'tree builders.getTreeBuilder', 'treewalkers.getTreeWalker', 'trie.Trie', 'urllib.error', 'urllib.parse', 'urllib.request', 'urllib3', 'urllib3.packages.backports.makefile', 'usercustomize', 'xmlrpc.client'] *** binary dependencies *** Your executable(s) also depend on these dlls which are not included, you may or may not need to distribute them. Make sure you have the license if you distribute any of them, and make sure you don't distribute files belonging to the operating system. OLEAUT32.dll - C:\WINDOWS\system32\OLEAUT32.dll USER32.dll - C:\WINDOWS\system32\USER32.dll IMM32.dll - C:\WINDOWS\system32\IMM32.dll SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll ole32.dll - C:\WINDOWS\system32\ole32.dll COMDLG32.dll - C:\WINDOWS\system32\COMDLG32.dll COMCTL32.dll - C:\WINDOWS\system32\COMCTL32.dll ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll NETAPI32.dll - C:\WINDOWS\system32\NETAPI32.dll WS2_32.dll - C:\WINDOWS\system32\WS2_32.dll GDI32.dll - C:\WINDOWS\system32\GDI32.dll VERSION.dll - C:\WINDOWS\system32\VERSION.dll KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll ntdll.dll - C:\WINDOWS\system32\ntdll.dll 
+5
source share

Source: https://habr.com/ru/post/1258061/


All Articles