Before using pycharm software to develop python games, you need to install the pygame plug-in. How to install it?
Method 1. Package manager installation
1. Locate file – settings in the pycharm software
2. Navigate to: project (in your own project) – python interpreter, select pip
3. Double-click pip to enter the query plug-in interface, enter pygame , query this plug-in, and finally click install package
Method 2. Command line installation
1. Open PyCharm and create a new Python project. You can choose any suitable name and location to save the project. Make sure you have configured the Python interpreter correctly.
- Open PyCharm and find your project in the project navigation bar on the right.
- Right-click and select "Open Terminal".
- In the terminal, enter the following command to install Pygame:
pip install pygame
- Wait for the installation to complete. Once the installation is complete, you can start using Pygame in your projects.
Python command line installation pygame
Lower left corner win + r Open Run Enter cmd
python -m pip install -U pygame --user
Prerequisite: pip has been installed
2. If you find that it is not available, you can use this command to install it:
python -m pip install -U pip
Then execute
python -m pip install -U pygame --user
During the game programming process, it prompts what plug-in is missing. The installation method is as above.