Python 2.7 Pygames不起作用
我买了一台新电脑,当我试着运行这个代码时,我试着放上pygamePython 2.7 Pygames不起作用,python-2.7,pygame,Python 2.7,Pygame,我买了一台新电脑,当我试着运行这个代码时,我试着放上pygame import pygame pygame.init() screen = pygame.display.set_mode((1176,674),0,32) 我得到这个错误 Traceback (most recent call last): File "/Users/nathaneuteneier/Documents/how", line 1, in <module> import pygame
import pygame
pygame.init()
screen = pygame.display.set_mode((1176,674),0,32)
我得到这个错误
Traceback (most recent call last):
File "/Users/nathaneuteneier/Documents/how", line 1, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 95, in <module>
from pygame.base import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so: no matching architecture in universal wrapper
回溯(最近一次呼叫最后一次):
文件“/Users/nathaneunteineier/Documents/how”,第1行,在
导入pygame
文件“/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site packages/pygame/_init__.py”,第95行,在
从pygame.base导入*
ImportError:dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,2):未找到合适的映像。确实发现:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:通用包装器中没有匹配的体系结构
基本上
import error
这意味着解释器无法将模块正确地“导入”到程序中。
另外,在交互模式下,如果键入
import pygame
那么结果如何?
在任何情况下,请再次尝试从web下载pygame模块。
此外,错误可能是由于32位和64位版本不兼容造成的。从上面提供的链接下载正确的版本。检查您使用的是哪个(32或64)位。在交互模式下键入以下内容:-
import platform
platform.architecture()
这将为您提供正在运行的python解释器的正确位顺序