3

I'm using a mac and typed

pip install pygame

into my terminal.

The terminal said the download was successful, but when I use

import pygame

in IDLE, I get an error.

I've looked at questions similar to this one and have not found an answer. Does anyone know what the problem could be?

Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48

1 Answers1

3

Your terminal is referring to a different environment that the one that your IDLE environment refers to. For example Pycharm saves its python packages in the venv folder by default. Pip installing a package through the terminal would not allow you to import the package inside pycharm because you have not installed it in the venv environment.

To fix this, I believe you should use the command

 source activate

in order to activate the environment that IDLE is running. You should be able to install it, and import it then.