If you are using a Linux system and Python 3, you need to use pip to install Pygame. pip is a program that downloads and installs Python packages for you.
#1. First check whether pip is installed.
pip --version
Or use find / -name pip to check whether it has been installed. If it is installed, the installation path will be found. At the same time, if it is installed, but the prompt pip: command not found is displayed, you need to create a soft link to let the system recognize the pip command:
ln -sv /usr/local/python3/bin/pip /usr/bin/pip
2. If it is not installed, you need to install it manually.
First download the get-pip.py file:
wget https://bootstrap.pypa.io/get-pip.py
If wget is not installed on the system, you can use yum install wget to install it, but an external network is required.
Then use the downloaded get-pip.py script to install PIP:
python3 get-pip.py
3. Use pip to install pygame:
pip install pygame 或者 pip install --user hg+http://bitbucket.org/pygame/pygame
The above is the detailed content of How to install pygame on Linux?. For more information, please follow other related articles on the PHP Chinese website!