Hermit icon indicating copy to clipboard operation
Hermit copied to clipboard

ImportError: No module named _view

Open dongyuwei opened this issue 5 years ago • 5 comments

python main.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "main.py", line 18, in <module>
    import pygame._view
ImportError: No module named _view

tested with Python 2.7.16

Hi @LingDong- , can you provide your pip requirements.txt?

dongyuwei avatar Jul 09 '19 06:07 dongyuwei

Hi there, it appears that the newer versions of pygame no longer have _view module, but the fix turned out be super simple: Just comment out that line in main.py and it will work! Just tested on 2.7.15 and pygame 1.9.4.

import pygame
# import pygame._view  #<--- comment out this line
import numpy

I haven't ran the project for a while myself, and it seems that it is more laggy than it used to be, and the loading screen is blank. Something must have changed with pygame over the years. Will look into it when I have time.

Thanks.

LingDong- avatar Jul 09 '19 16:07 LingDong-

Thanks for your quick reply. The exception disappeared, it prints a loaded log. But the window keeps blank.

dongyuwei avatar Jul 10 '19 03:07 dongyuwei

It would be better to use virtualenv and lockdown all the dependencies.

dongyuwei avatar Jul 10 '19 03:07 dongyuwei

Thanks for your quick reply. The exception disappeared, it prints a loaded log. But the window keeps blank.

+1, any workarounds?

bolechen avatar Dec 18 '19 11:12 bolechen