0
votes

I'm trying to install pygame using pip3 install pygame but this error appears:

ERROR: Command errored out with exit status 1: command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5p/25vgdgh93qvg09z18wyy0mg00000gn/T/pip-install-_f8kcuyb/pygame/setup.py'"'"'; file='"'"'/private/var/folders/5p/25vgdgh93qvg09z18wyy0mg00000gn/T/pip-install-_f8kcuyb/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/5p/25vgdgh93qvg09z18wyy0mg00000gn/T/pip-record-gd9_k1m6/install-record.txt --single-version-externally-managed --compile cwd: /private/var/folders/5p/25vgdgh93qvg09z18wyy0mg00000gn/T/pip-install-_f8kcuyb/pygame/

Send help =(

1

1 Answers

1
votes
  1. Before installing Pygame, there are many dependencies that will need to be installed. Begin by installing the XCode developer tools, which can be done through the app store.
  2. Next you will need to install the latest version of XQuartz. You can start the installation by visiting the site (here).
  3. Open a Terminal window. This can be done by pressing command+Space (⌘+Space) and typing Terminal in the search bar and pressing Enter. enter image description here
  4. You now need to install Homebrew. You can do this by typing the following command in the Terminal and pressing Enter:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

  5. After the installation is finished, you will need to type the following commands in the Terminal, pressing Enter after each one

    echo export PATH='usr/local/bin:$PATH' >> ~/.bash_profile

    brew update

    brew doctor

  6. You can now install Python 3 using Homebrew. To do this, type the following command in the Terminal and press Enter:

    brew install python3

  7. Now you need to install several dependencies for Pygame. Type the following commands in the Terminal, pressing Enter after each one:

    brew install mercurial

    brew install sdl sdl_image sdl_mixer sdl_ttf portmidi brew tap homebrew/headonly

    brew install smpeg

  8. You are ready to install Pygame. Type the following command in the Terminal and press Enter. Note that you will probably have to enter your password in the Terminal in order for the command to run:

    sudo pip3 install hg+http://bitbucket.org/pygame/pygame

  9. To verify the installation, you will have to launch the correct version of IDLE. You can find this by opening Finder, clicking on Go in the top left of the screen, then clicking on the Go to Folder… option.

  10. In the search bar, enter /usr/local/Cellar/python and click Go. Navigate to the folder where Python 3 is located. It will probably be named in this format: 3.x.x.

  11. Launch the IDLE 3 app within the folder. When launched, it should be using Python 3.x.x. In the IDLE interpreter, type the following command and press Enter:

    import pygame
    

    If the command completed without throwing any errors, you have successfully installed Pygame and found the correct version of IDLE to use for Pygame programming.

  12. To make finding this version of IDLE easier, you can create a Desktop shortcut for IDLE 3. If you want to do this, press and hold the control key and click on IDLE 3. It will open a Menu where you can select Make Alias and create another IDLE 3 icon. You can name this icon whatever you like, but make sure to drag it to your Desktop when you are done.