Search code examples
pythonpython-3.xpygamepyinstallerimporterror

PyInstaller doesn't read libraries


I finished making Snake in Pygame and I wanted to convert it into an app in pyinstaller. I'm working on a Mac. Even though I clearly installed the pygame module, and I even to installed it on the files path, when I run the .exe app after I converted it, it still gives me the ImportError: no module named pygame. You can obviously tell, I DO have pygame because I made my program in it. Happily, when I run the code from an editor, the program works fine. Can you please help?


Solution

  • If you used a virtual environment to develop your game then the module will not be installed to your main python path. Just do a pip install for the modules you are missing then try running pyinstaller again. Or run the pyinstaller in your virtual environment which might work but I have not tested.