there’s no pygame in Colab?

Question:

I saw some Python fractal rendering code and I wanted to try it inside Colab. I copied the code, made a new file, and copied it in and… it didn’t work. I wondered why, and it said “Module not found”.
The import code looked like this:

import pygame, sys, math, random, os
import numpy as np
import pyspace

This is what I think triggered the error itself:

import pygame

Like I said, I did this in Colab. Unless I figure out how to fix this myself, you need to figure out how to do this.

Asked By: PythonMBYT

||

Answers:

If its not there, you just need to install it.

!pip install pygame
Answered By: Anubhav Gupta
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.