I was build one exe file with python installer. The code is using numpy package and pyqt UI builder. I installed numpy in virtulal environment of my working folder. It is working in python script, then I build it as Exe file, then it is not working.
please help me if you know about the issue. Thanks
While using pyinstaller to convert.py file to.exe having large dependencies (like numpy, pandas) following these steps would solve the ModuleNotFound error:
Install the PIP packages in the project directory
Change the hook file
Navigate to \venv\Lib\site-packages\PyInstaller\hooks
If there is a hook-numpy.py file, edit the script to:
from PyInstaller.utils.hooks import collect_submodules
hiddenimports = collect_submodules('numpy._libs')
pyi-makespec — onefile program_name.py
...
hiddenimports = ['numpy']
...
pyinstaller — onefile program_name.spec
Finally, find the.exe file in the dist folder, and run it.
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.