Search code examples
pythonopencvpyinstaller

When I try to convert my .py file to a .exe, it gives an error when I try to run it


When I try to convert my .py file to .exe, it all works smoothly until I try running the .exe file. INFO: ERROR: recursion is detected during loading of "cv2" binary extensions. Check OpenCv installation. The pyinstaller command I used was "pyinstaller main.py --onefile -w". Does anyone know how to fix it?


Solution

  • You can try the miniconda to set up your python environment. Start the Anaconda Powershell Prompt and run:

    conda install -c conda-forge opencv pyinstaller

    to install the opencv and pyinstaller. After that, try build your scripts.

    pyinstaller.exe main.py