Any one know how to create an executable file for a python project. I have open CV imported in a file , I used PYinstaller to create an executable file, but if i run that executable it is showing that "No module named cv2".Please Help me.
Related
I am trying to create an executable file which is using module python-docx.
The executable files is created but this error occurs when I run the executable file.
[Errno 2] No such file or directory: 'D:\Pycharm Projects\pydocx\dist\library.zip\docx\parts\..\templates\default-footer.xml'
The normal .py file which I am trying to convert into a .exe works perfectly fine.
Can anyone suggest how should I resolve this
Switched to pyinstaller and everything worked flawlessly.
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.
enter image description here
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 (with virtual environment activated)
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')
Before converting to .exe file, make .spec file using the following command:
pyi-makespec — onefile program_name.py
Edit the .spec file (open using notepad)
append the libraries to the hiddenimports list
...
hiddenimports = ['numpy']
...
Compile the script using the .spec file with the following command:
pyinstaller — onefile program_name.spec
Finally, find the .exe file in the dist folder, and run it.
I'm trying to create a exe file from my .py file but using both, PYINSTALLER and PY2EXE gives me a strange error:
The google.py file that I'm tying to create EXE existis in the requested directory and both PYINSTALLER and PY2EXE are correctlly installed.
Does anyone know the root cause of the issue? How could I create a exe file from a .PY?
As I know you must use argument --onefile Without it the libraries will be distributed as separate file along with the executable.
Here is exaple:
pyinstaller --onefile script.py
A python script uses a .so file.
I made an exe for this python script using PyInstaller.
But when I execute the generated exe, it is unable to locate this .so file
So how to link this .so to a python code that will get converted to a .exe
Note: when running the .py program, if I set the location of .so in LD_LIBRARY_PATH, it executes the program correctly but once I make the exe using
pyinstaller script.py --onefile
(with .so in the same directory), it doesnt find the .so file..
Thank you in advance
You need to make sure that your . so file is in your system library path as well as your python library path. Setting your LD path is a quick fix. PyInstaller will need it in your system path. Depending on your Windows version it's Environment variables>PATH.
Good day, I've been trying to turn a .py script to a .exe, I've run the following command: "python pyinstaller.py EyeBreak.py" in cmd and got an error: ImportError: no module named wintypes, looking at the questions on SO I downloaded the .dll file and placed it in the same folder as pyinstaller, but i still get the same error. How can I fix this? Is there a better way to turn a .py to a .exe?
Here is my code if relevant: https://github.com/Faresalghazy/EyeBreak/blob/master/eyebreak.py