【发布时间】:2021-12-19 09:38:46
【问题描述】:
我已经安装了 python 3.3.2 和 pygame 1.9.2a0。每当我尝试通过键入以下内容导入 pygame 时:
导入 pygame
我收到以下错误消息:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pygame
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
ImportError: No module named 'pygame'
>>>
我解决了一些与此错误相关的问题,但没有一个解决方案有帮助。 我有 Win7 操作系统的 64 位机器
【问题讨论】:
-
你是如何安装 pygame 的?容易安装?从源代码构建?
-
easy_install 。我不是从源代码构建的。
-
打开一个python shell并输入
import sys; print sys.path。如果 pygame 不在您的 PYTHONPATH 上,那么您需要添加它。很奇怪easy_install没有把它放在那里。 python3.3.2是唯一的python安装吗?还是你也有python2.7.4之类的? -
我已经卸载了以前的安装并安装了新的。 pygame的路径是什么。我不认为它在那里。我刚刚检查了 print (sys.path)
-
因为您使用的是 3.3 32 位 python,所以这个安装程序可以工作 bitbucket.org/pygame/pygame/downloads/…