Skip to content

Instantly share code, notes, and snippets.

@BrambleXu
Created November 5, 2018 13:46
Show Gist options
  • Save BrambleXu/fc7793a5c477c7d6f243ba72df023303 to your computer and use it in GitHub Desktop.
Save BrambleXu/fc7793a5c477c7d6f243ba72df023303 to your computer and use it in GitHub Desktop.
Installing Pygame, Python 3.6 with Anaconda on OS X

Please make sure you already install the Anaconda.

I will create a virtual environment with anaconda and install the pygame in this virtual environment.

  • First create a virtual environment called pygame and install the Python 3.6 version.
conda create --name pygame python=3.6
  • Change to the pygame virtual environment.
conda activate pygame
  • Install pygame
python3 -m pip install -U pygame --user
  • Test pygame
python3 -m pygame.examples.aliens

If it works, you are ready to go!

@PaawanSharma
Copy link

Can you help me please? When I follow these instructions, Pygame is added to my base environment too, which I don't want. I know it's there because if I deactivate the new environment and run python I can still import pygame.

@tammojan
Copy link

tammojan commented Jul 8, 2019

Probably

Can you help me please? When I follow these instructions, Pygame is added to my base environment too, which I don't want. I know it's there because if I deactivate the new environment and run python I can still import pygame.

If you omit --user the package gets installed into the conda environment, that's better.

@dlmorales-amee
Copy link

Worked perfectly fine, if you get this error: missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun ,I would suggest following instructions on: https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun/

@farhodfm
Copy link

Probably

Can you help me please? When I follow these instructions, Pygame is added to my base environment too, which I don't want. I know it's there because if I deactivate the new environment and run python I can still import pygame.

If you omit --user the package gets installed into the conda environment, that's better.

Your comment was very helpful. Thank you!

@chriba76
Copy link

That was it! Thank you! I've been searching the Internet for hours…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment