How do I import pygame on 3.7.1?

Viewed 464

I'm running python 3.7.1 on my MacBook and it has been running perfectly until I tried importing pygame. I'm taking an intro to python class and we always just do from module import *. When I tried to do that same format with pygame I just got an error ModuleNotFoundError: No module named 'pygame'

What should I do about using pygame or should I just forget using pygame altogether

I'm new to python and the reason I'm trying to use pygame is that I'm making a game where the user controls a .gif or a spaceship and tries to avoid asteroids. All of my code is solid accept for the collision detection. Everyone seems to point me towards using pygame but i can't get that to work. Should I continue to use pygame and if so, how do i fix my problem? Should I drop pygame altogether and just try collision detection a different way; (if so, what other way?)

2 Answers

pygame is not bundled in standard python.

to install pygame in Mac, see Mac installation from pygame.org

Also, from module import * is not a good practice if you're using more modules,

which will causes class name conflicts.

Easiest way to do it - forget 3.7.1 go on the Python website (linked) and download 3.6.7 ther when your setting up click add to PATH then you need to install pygame ( save it locally near where python is saved) then go on to terminal by going to finder and clicking applications and search terminal and type pip install pygame if there is anything you are confused about just ask (: Path button

Related