我还有点新意,所以我希望这没关系,但无论如何:
我正处于一个小项目的中间,尝试使用python学习一些基本的游戏设计。我一直在最新版本的macOS Sierra上使用Pygame(从Python.org网站下载Python 2.7),当我尝试运行代码时,我一直收到以下错误
Traceback (most recent call last):
File "Pong.py", line 8, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 133, in <module>
from pygame.base import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/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): Symbol not found: _SDL_EnableUNICODE
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so
我已经对错误进行了一些研究,并且提出谷歌搜索的唯一网站似乎是德语。我不认为任何人能够告诉我为什么我会在pygame模块中收到此错误以及如何修复它?如果需要,我可以提供源代码,但是从我(理所当然有限)理解错误在于导入的pygame模块?
编辑:如果我从错误中提到的文件中删除from pygame.base import *
,我会收到以下错误:
Traceback (most recent call last):
File "Pong.py", line 8, in <module>
import pygame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py", line 134, in <module>
from pygame.constants import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/pygame/__init__.py", line 98, in <module>
from pygame.rect import Rect
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so, 2): Symbol not found: _SDL_EnableUNICODE
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so