Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy
 

How to install pygame via python pip




pygame - Python Game Development, it belongs to Classifiers:

- Development Status :: 6 - Mature
- License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
- Operating System :: Unix
- Programming Language :: Assembly
- Programming Language :: C
- Programming Language :: Cython
- Programming Language :: Objective C
- Programming Language :: Python :: Implementation :: PyPy
- Topic :: Games/Entertainment
- Topic :: Multimedia
- Topic :: Multimedia :: Graphics
- Topic :: Multimedia :: Graphics :: Capture
- Topic :: Multimedia :: Graphics :: Capture :: Digital Camera
- Topic :: Multimedia :: Graphics :: Capture :: Screen Capture
- Topic :: Multimedia :: Graphics :: Graphics Conversion
- Topic :: Multimedia :: Graphics :: Viewers
- Topic :: Multimedia :: Sound/Audio
- Topic :: Multimedia :: Sound/Audio :: MIDI
- Topic :: Multimedia :: Sound/Audio :: Players

When you know about this project and you want to new install pygame to support your project or you get trouble as ModuleNotFoundError: No module named "pygame" or ImportError: cannot import name "pygame" in your project, let follow this tutorial to install pygame



Installation:

Step 1: First, ensure you installed pip in your os, to check pip has been installed on your computer

In Windows (CMD):

py -m pip --version

In Unix/macOS:

python3 -m pip --version

Ensure pip, setuptools, and wheel are up to date:

In Windows (CMD):

py -m pip install --upgrade pip setuptools wheel

In Unix/macOS:

python3 -m pip install --upgrade pip setuptools wheel


Optional - If you want to install in virtual environment:

In Windows (CMD):

- Install virtualenv - if you installed it, please ignore

py -m pip install --user virtualenv

- Create a virtual environment

py -m venv test_pygame_env

- Active the virtual environment

test_pygame_env\Scripts\active

In Unix/macOS:

- Install virtualenv - if you installed it, please ignore

pip3 install virtualenv

- Create a virtual environment

python3 -m venv test_pygame_env

- Active the virtual environment

source test_pygame_env/bin/active


Step 2: OK, now, let flow below content to start the installation pygame

To install pygame on Windows(CMD):

py -m pip install pygame

To install pygame on Unix/macOs:

pip install pygame


Step 3: If you want to install a specific pygame version, add ==<pygame version> to the end command line

Example:

pip install pygame==1.7.1


Please see the version list below table:

VersionReleased dateCommand
pygame 2.1.22021-12-27T04:07:15Windows:

py -m pip install pygame==2.1.2

Unix/macOs:

pip install pygame==2.1.2

pygame 2.1.12021-12-24T21:45:58Windows:

py -m pip install pygame==2.1.1

Unix/macOs:

pip install pygame==2.1.1

pygame 2.1.02021-11-07T09:50:22Windows:

py -m pip install pygame==2.1.0

Unix/macOs:

pip install pygame==2.1.0

pygame 2.0.32021-10-31T15:53:54Windows:

py -m pip install pygame==2.0.3

Unix/macOs:

pip install pygame==2.0.3

pygame 2.0.22021-10-10T09:56:57Windows:

py -m pip install pygame==2.0.2

Unix/macOs:

pip install pygame==2.0.2

pygame 2.0.12020-12-24T12:53:43Windows:

py -m pip install pygame==2.0.1

Unix/macOs:

pip install pygame==2.0.1

pygame 2.0.02020-10-28T16:35:55Windows:

py -m pip install pygame==2.0.0

Unix/macOs:

pip install pygame==2.0.0

pygame 1.9.62019-04-25T13:29:48Windows:

py -m pip install pygame==1.9.6

Unix/macOs:

pip install pygame==1.9.6

pygame 1.9.52019-03-31T10:36:43Windows:

py -m pip install pygame==1.9.5

Unix/macOs:

pip install pygame==1.9.5

pygame 1.9.42018-07-19T09:28:22Windows:

py -m pip install pygame==1.9.4

Unix/macOs:

pip install pygame==1.9.4

pygame 1.9.32017-01-16T21:11:27Windows:

py -m pip install pygame==1.9.3

Unix/macOs:

pip install pygame==1.9.3

pygame 1.9.22016-12-13T13:25:20Windows:

py -m pip install pygame==1.9.2

Unix/macOs:

pip install pygame==1.9.2

pygame 1.8.12008-08-07T00:50:12Windows:

py -m pip install pygame==1.8.1

Unix/macOs:

pip install pygame==1.8.1

pygame 1.8.02008-03-30T12:08:49Windows:

py -m pip install pygame==1.8.0

Unix/macOs:

pip install pygame==1.8.0

pygame 1.7.12005-08-16T09:53:00Windows:

py -m pip install pygame==1.7.1

Unix/macOs:

pip install pygame==1.7.1


Step 4: Otherwise, you can install pygame from local archives:

Download the distribution file from pygame-2.1.2.tar.gz or the specific pygame version in the below list of distribution

After that, install by command:

On Windows(CMD):

py -m pip install <path_to_pygame_downloaded_file>

On Unix/macOs:

pip install <path_to_pygame_downloaded_file>


List distribution:


Project link:

- Homepage
- Bug Tracker
- Documentation
- Source
- Twitter