Python Forum
How generate a exe file from py
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How generate a exe file from py
#1
Hello all,
I need help from you about creating a exe file by using pyinstaller because I am blocked on two weeks now.
The thing is : I developed a little application to calculate a temperature of a material.
The program run well on python with no error.
But when I try to create exe file, I get these messages (and no exe file is created at the dist and build path) :

============

C:\Users\AZ>pyinstaller --onefile -w main.py
1446 INFO: PyInstaller: 3.4
1446 INFO: Python: 3.5.0
1460 INFO: Platform: Windows-10.0.17134
1465 INFO: wrote C:\Users\AZ\main.spec
1490 INFO: UPX is not available.
1496 INFO: Extending PYTHONPATH with paths
['C:\\Users\\AZ', 'C:\\Users\\AZ']
1496 INFO: checking Analysis
1496 INFO: Building Analysis because Analysis-00.toc is non existent
1496 INFO: Initializing module dependency graph...
1506 INFO: Initializing module graph hooks...
1599 INFO: Analyzing base_library.zip ...
12836 INFO: running Analysis Analysis-00.toc
14845 WARNING: lib not found: api-ms-win-core-file-l2-1-0.dll dependency of C:\Windows\WinSxS\x86_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_10.0.17134.1_none_50c6cb8431e7428f\ucrtbase.dll
15406 INFO: Caching module hooks...
15496 INFO: Analyzing C:\Users\AZ\main.py
17126 INFO: Processing pre-find module path hook distutils
21309 INFO: Processing pre-find module path hook site
21315 INFO: site: retargeting to fake-dir 'c:\\program files (x86)\\python 3.5\\lib\\site-packages\\PyInstaller\\fake-modules'
27375 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ImportError: No module named 'win32com'
34225 INFO: Loading module hooks...
34227 INFO: Loading module hook "hook-lib2to3.py"...
34339 INFO: Loading module hook "hook-numpy.py"...
34345 INFO: Loading module hook "hook-setuptools.py"...
35766 WARNING: Hidden import "setuptools.msvc" not found!
35766 INFO: Loading module hook "hook-PyQt5.py"...
36045 INFO: Loading module hook "hook-xml.py"...
36045 INFO: Loading module hook "hook-sysconfig.py"...
36066 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
Traceback (most recent call last):
File "c:\program files (x86)\python 3.5\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python 3.5\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python 3.5\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 17, in <module>
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
self.__postinit__()
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\build_main.py", line 500, in assemble
module_hook.post_graph()
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\compat.py", line 736, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 385, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 806, in load_module
File "<frozen importlib._bootstrap_external>", line 665, in load_module
File "<frozen importlib._bootstrap>", line 268, in _load_module_shim
File "<frozen importlib._bootstrap>", line 693, in _load
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\hooks\hook-PyQt5.QtWidgets.py", line 11, in <module>
hiddenimports, binaries, datas = add_qt5_dependencies(__file__)
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 514, in add_qt5_dependencies
more_binaries = qt_plugins_binaries(plugin, namespace=namespace)
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 132, in qt_plugins_binaries
pdir = qt_plugins_dir(namespace=namespace)
File "c:\program files (x86)\python 3.5\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 117, in qt_plugins_dir
""".format(namespace, ", ".join(paths)))
Exception:
Cannot find existing PyQt5 plugin directories
Paths checked: C:/Qt/5.6.0/plugins

========

So, if somewone can exmpain me this and what can I do, I realy apreciate.
Reply
#2
Quote:Cannot find existing PyQt5 plugin directories
Paths checked: C:/Qt/5.6.0/plugins
This is obviously the problem stated directly in the error message.

You could try this
Quote:Your application is failing to launch because it cannot import the PyQt5 modules. You may add PyQt5 (or each of the PyQt5 modules that you are using) to the hiddenimports list in the .spec file that was generated after you first bundled this application with PyInstaller and regenerating the executable. Alternatively, you could explicitly add PyQt5 to your .py file by adding import PyQt5 before from PyQt5.QtWidgets import *

more info
https://blog.aaronhktan.com/posts/2018/0...executable
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I created a function that generate a list but the list is empty in a new .py file mrhopeedu 2 2,285 Oct-12-2019, 08:02 PM
Last Post: mrhopeedu
  how to generate sha256 hash for each line of my txt file | using python version 3.6.4 rajtekken5 2 9,074 Feb-11-2018, 01:41 PM
Last Post: rajtekken5

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020