Python pygame Installation notes, pythonpygame
Today I saw a tutorial about installing the pygame module in Python. I think it's good. Let's share it with you.
Install Python
Well, this question seems redundant here. But in order to take care of the children's shoes I just learned Python, I should say a few more words.
The details are as follows:
Go to the Python official website. Download the required version. Here I download the 64-bit windows Python msi. If you do not understand the installation process, select default.
Install easy_install
What is this? We don't have to worry about it. Now we only need to know that it can help us install some libraries. The specific installation process is also very simple. You only need to download this library and install it using python commands.
Install pip
Well, after the two steps above, I think everyone (especially the beginner's shoes) will be upset. How can we install so many things. But don't be discouraged, because good days are coming soon. Pip is such an artifact that can free you from the complex labor of installing libraries. Let's take a look at how to install pip.
Before that, make sure that Python and easy_install are installed on your windows system.
Successfully installed:
Microsoft Windows [version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C: \ Users \ Administrator> pythonPython 2.7.11 (v2.7.11: 6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright ", "credits" or "license" for more information. >>> exit () C: \ Users \ Administrator> easy_install-versionusage: easy_install [options] requirement_or_url... or: easy_install -- helperror: option-r not recognizedC: \ Users \ Administrator>
Next, switch the directory to the Script folder under the python installation directory and enter
Easy_install pip. Of course, if you want to make it easier, you can configure this path to your environment variables (as for how to configure it, there are a lot of relevant tutorials on the Internet. I will not duplicate the wheel ).
Verify:
C:\Users\Administrator>pip -vUsage: pip <command> [options]Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion help Show help for commands.General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. --log <path> Path to a verbose appending log. --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup. --trusted-host
Install pygame
To install pygame, you must first download this file. So we need to download it. Download the pygame file. Remember to download the corresponding Python version.
After downloading, we will find that it is a file with the. whl suffix. This is embarrassing. How to open it?
The answer is to use another tool, wheel. In essence, wheel is a zip package. It uses the. whl extension and is used for python module installation. It appears to replace Eggs. Wheel also provides a bdist_wheel extension command as setuptools, which can be used to generate the wheel package. Run the following command to check whether the installation is successful.
How to install the wheel is much better this time. Because we already have pip.
pip install wheel
. Done.
Now let's go back to the directory pygameXXXXX. whl, and get the file name of the wheel.
Verify
C:\Users\Administrator>pythonPython 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pygame>>>
If an error is reported, the installation is successful. Next, let's start a pleasant pygame journey.
Summary
The overall installation process is quite confusing. Especially for those first-entry children's shoes. However, this is also the most valuable experience. Because the installation of these libraries will make you more familiar with the Python architecture. The overall structure will be better grasped.
So calm down. Step by step. I believe this will be of great help to your Python. We also hope that you can support the customer's home.