简体   繁体   中英

How do I install pygame on python 3.6?

So I am having a bit of trouble with my python/pygame. I want to install pygame but i just dont know how to do it. I have been looking around on the web now for a while and tried multiple things. It just does not work...

Here is how I installed pygame on my Windows 10 Home 64 bit system with Python 3.6. (I installed Python through Anaconda but this should also work if you used python.org.)

  1. Download the latest version of pygame, 1.9.3, from https://pypi.python.org/pypi/Pygame/1.9.3 . For the system I described the proper file is

    pygame-1.9.3-cp36-cp36m-win_amd64.whl.

    (That file is near the bottom of the list on the given page. Despite the "amd" in the file name, that is not just for AMD processors but for any 64-bit Windows 10.) Save the file to a directory you can reach with the Windows command line (also called the DOS box) or Windows PowerShell as an administrator.

  2. Open a Windows command line (DOS box) or PowerShell in that directory as an administrator. One way to do that is to open that directory in File Explorer, click the "File" tab on the far left near the top, hover the mouse over "Open Windows PowerShell", then click "Open Windows PowerShell as Administrator." Another way is to press Windows-R, enter "cmd.exe", and "cd" to the proper directory.
  3. In the command line/DOS box/PowerShell window, enter the command

    pip install pygame-1.9.3-cp36-cp36m-win_amd64.whl

  4. Test the installation by opening Python and entering

    import pygame

在Linux上,从https://pypi.python.org/pypi/Pygame/1.9.3下载适当的whl文件,将其解压缩到您拥有python站点软件包的文件夹中,然后完成。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM