Python Forum
[PyGame] Apparently module has no attribute display?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Apparently module has no attribute display?
#11
(Dec-17-2017, 08:06 PM)Klar Wrote: All I've found with the search (not the ones you suggested since I use windows, not linux) have lead me to a folder named pygame, followed by a folder name __pycache__, followed by the .pyc for the .init

Folders cannot be named pygame either. Uninstall pygame and remove all related. Make sure you get an import error after this with no module named pygame before installing again
Recommended Tutorials:
Reply
#12
Just great. I did that and now it keeps saying that there is no module named pygame. It's very clearly installed in the site-packages folder!
Reply
#13
now just do
pip3 install pygame
and it should do everything for you

How did you install before?
Quote:/usr/lib/python3.6/site-packages/pygame-1.9.3-py3.6-linux-x86_64.egg/pygame/__init__.py
My pip always installs to local

>>> import pygame
>>> pygame.__file__
'/usr/local/lib/python3.6/site-packages/pygame/__init__.py'
metulburr@ubuntu:~$ ls /usr/local/lib/python3.6/site-packages | grep pygame
pygame
pygame-1.9.3.dist-info
Recommended Tutorials:
Reply
#14
I already installed it, it's very clearly installed in site-packages, and it STILL says that there's no module named pygame
Reply
#15
Didnt realize you were on windows....

After you did install and are getting no method named init()....what was/is the output of the following in the python interpreter (assuming you re-install it and get the same issue again)
>>> import pygame
>>> pygame.__file__
what is the output of this in the python interpreter
>>> import sys
>>> sys.path
Recommended Tutorials:
Reply
#16
@metulburr
Quote:How did you install before?
I compile my from source because of high cpu usage.

@Klar
Might be environment variable.
try this
import sys
sys.path.append('path to pygame')
import pygame
99 percent of computer problems exists between chair and keyboard.
Reply
#17
I tried that. It didn't work. As always.
Reply
#18
@Windspar
Yeah i got confused between your posts and the OP's posts, thought the OP was on linux.
Recommended Tutorials:
Reply
#19
How many pythons do you have installed on your computer ?

your path to pygame. It didn't include pygame in path ?
Show path to pygame might help.
99 percent of computer problems exists between chair and keyboard.
Reply
#20
(Dec-17-2017, 01:32 AM)Klar Wrote: Doing that makes it say that module has no attribute init()
This means
  • Your installation is messed up or
  • you named a file or directory "pygame" and it is trying to import that instead of the proper pygame.

If you didnt name anything "pygame" then there is something wrong with the installation (of pygame). If you uninstalled pygame and now you get a no module named pygame error, we can rule out the file/directory named pygame, as that would still load the wrongly named module you created even after uninstalling pygame. Unless for some reason you added a directory named "pygame" yourself in the python library?

How did you install pygame? State explicitly what you did, where you got it from (inlcude link here), any output or error you had while installing it, etc. Did you compile it yourself or did you install a wheel? Did you install it with pip? Either way show the command prompt output from either of them. How many python versions do you have on your computer? For all we know you are getting it from an odd source that has a directory named pygame in it loading it incorrectly.

We can only tell what is wrong by how much information you give...and the less you give, the more likely we are not going to diagnose it. When we tell you to run something and give us the info that is a way for us to help diagnose the problem. Like you never responded with the output of this. So basically at this point i cant help you as you are not running the code i am giving you to help diagnose your problem.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Apparently module has no attribute display? Angelo26 1 1,952 Mar-11-2020, 07:14 PM
Last Post: nilamo
  [split] Apparently module has no attribute display? Kolterdyx 1 2,774 Sep-09-2018, 05:14 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020