简体   繁体   English

如何使用Windows二进制安装程序(.msi)在Windows 64BIT上安装pygame(ImportError:没有名为“ pygame”的模块)

[英]how to install pygame on windows 64BIT using windows binary installer (.msi) (ImportError: No module named 'pygame')

I have installed python 32BIT on my 64BIT windows 7. Because I want to use pygame. 我已经在64BIT Windows 7上安装了python 32BIT。因为我想使用pygame。 Now, I also have downloaded pygame and have read the documentation for installing. 现在,我还下载了pygame并阅读了安装文档。 I install pygame (after installing python). 我安装pygame(安装python之后)。 But when in python I run import pygame I get the the following error: 但是当在python中运行import pygame ,出现以下错误:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
ImportError: No module named 'pygame'

How can should I skip this error? 我应该如何跳过此错误?

EDITED ---------------- 编辑----------------

When I copy the pygame.msi installer in the pygame installation folder, and install it, and then run the import pygame command, I get the following error: 当我在pygame安装文件夹中复制pygame.msi安装程序并安装它,然后运行import pygame命令时,出现以下错误:

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "C:\Python33\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: The specified module could not be found. 

This is for future users: 这是供将来的用户使用的:

I had installed python x86 version 3.3 and the pygame was version 2.8. 我已经安装了python x86版本3.3,而pygame是版本2.8。

I installed pygame version 2.9(from bitbucket site), even without uninstalling the previous pygame, and it worked out. 我安装了pygame 2.9版(从bitbucket站点下载),即使没有卸载以前的pygame,它也能正常工作。 During the installation, if it finds the proper python installed, it will probably works, but if it does not find any installation, it probably will fail. 在安装过程中,如果找到正确安装的python,它可能会工作,但如果找不到任何安装,则可能会失败。

Py game for Win64bit 8.1 Win64bit 8.1的Py游戏

Do not download the 64 bit version of pygame from the website, instead click on the link in the bottom which says 'There are some pre release binaries for 64bit windows, and for python 2.7 at', it will open the unofficial downloads for python window. 不要从网站上下载pygame的64位版本,而是单击底部的链接,上面写着“有一些针对64位Windows的预发布二进制文件,对于python 2.7 at”,它将打开python窗口的非正式下载。 Then download the pygame-1.9.2a0-cp35-none-win32.whl. 然后下载pygame-1.9.2a0-cp35-none-win32.whl。 (Download the 32 bit although your windows is 64 bit.) (尽管您的Windows是64位,也请下载32位。)

Follow these steps- 跟着这些步骤-

  • Rename the .whl file to .zip and extract the the three folders. 将.whl文件重命名为.zip并解压缩这三个文件夹。

    Copy all the .h files in the pygame-----.data and paste it in the hard disk //Python3../include/pygame(New Folder). 复制pygame-----.data中的所有.h文件,并将其粘贴到硬盘//Python3../include/pygame(New Folder)中。

    Go back to the .whl(downloaded) folder and copy the folders pygame...data and pygame..dist. 返回.whl(下载的)文件夹,然后复制pygame ... data和pygame..dist文件夹。

    Paste the above downloaded folders in the folder //Python3../lib/site-packages. 将上面下载的文件夹粘贴到//Python3../lib/site-packages文件夹中。

    Run Windows shell or command prompt as a admin and type python pip3install pygame. 以管理员身份运行Windows Shell或命令提示符,然后键入python pip3install pygame。

    import python. 导入python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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