Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Apparently module has no attribute display?
(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
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!
now just do
pip3 install pygame
and it should do everything for you

How did you install before?
My pip always installs to local

>>> import pygame
>>> pygame.__file__
metulburr@ubuntu:~$ ls /usr/local/lib/python3.6/site-packages | grep pygame
I already installed it, it's very clearly installed in site-packages, and it STILL says that there's no module named pygame
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
Quote:How did you install before?
I compile my from source because of high cpu usage.

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.
I tried that. It didn't work. As always.
Yeah i got confused between your posts and the OP's posts, thought the OP was on linux.
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.
(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.
Windspar likes this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  [split] Apparently module has no attribute display? Kolterdyx 1 312 Sep-09-2018, 05:14 AM
Last Post: buran
  Battleships Program must display how many ships are left after each turn FnaticPutin 1 804 Oct-24-2017, 03:21 PM
Last Post: Windspar

Forum Jump:

Users browsing this thread: 1 Guest(s)