M HYPE SPLASH
// news

trying to run a python game with source code in terminal, unbuntu 18.04

By John Peck

not to get to complicated but I just wanted to run a simple tic tac toe program but couldn't find one that worked so i gravitated towards this after a duckduckgo search for python games, have no idea what i'm doing, any suggestion for a newbie would be great

I do not know what I am doing, can basically do "hello world" or "blastoff" and run it in the terminal. that's it I logged into github and downloaded the zip file of asteroid in the link above. placed it in the directory i wanted to run it in and got an error message trying to run the game in terminal. the file downloaded was a folder called "a-python-game-master" and it downloaded to the desktop

cd Desktop
cd a-python-game-master
python3 Asteroid.py

the error message is belowenter image description here

Traceback (most recent call last): File "Asteroid.py", line 6, in <module> from Vex import Vex File "/home/brian/Desktop/a-python-game-master/Vex.py", line 3, in <module> import Environment File "/home/brian/Desktop/a-python-game-master/Environment.py", line 1, in <module> import pygame
ModuleNotFoundError: No module named 'pygame'
2

1 Answer

You've got (2) problems, neither is easily fixable. The module that your games are complaining about - pygame - is available for python2 on Ubuntu 18 in package python-pygame (which won't work with these games). However, it is available for python3 on Ubuntu 19 in package python3-pygame (which I assume works, but doesn't help you).

The source code for pygame is readily available, so if you're up to it, you could build it yourself.

FYI: the script you need to run is MainGame.py, not Asteroids.py (and it's super buggy).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy