Try to make an egg with pygame and add it to the data. Also add into hiddenimports as you are doing and install it in pip. I think you can't do the onefile tag (not sure 100%) as you need folders in order to search for the aditional script files.
I'm doing all of them and my program is working. I don't know if all is needed but with those, it is working. El jueves, 22 de agosto de 2019, 18:25:33 (UTC+2), Novice Philadelphia .D escribió: > > I am trying to use Pyinstaller to make my .py to .exe. > I used >> pyinstaller --onefile -w main.py to generate files and an exe. > But when I tried to run it by terminal in PyCharm, these error comes out: > > Traceback (most recent call last): > File "main.py", line 1, in <module> > import Setting > File > "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", > > line 627, in exec_module > exec(bytecode, module.__dict__) > File "Setting.py", line 1, in <module> > import pygame > ModuleNotFoundError: No module named 'pygame' > [5458] Failed to execute script main > > I have added 'pygame' inside hiddenimports and the absolute path of pygame > folder(something like '....../venv/lib/python3.7/site-packages/pygame/') > inside pathex in my main.spec. > These are the solutions that I can find from google but it doesn't work. > Same error just comes out again :( > > I've tried import Pygame in just Hello World but still having error. > > Any can help me? > -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/9e5636c9-feb9-499d-bd71-10619409fd97%40googlegroups.com.
