Python3 + Pygame在Idle中工作,但不是在终端时工作

时间:2017-04-20 00:29:13

标签: macos python-3.x pygame

首先感谢您花时间阅读本文。我是堆叠溢出的新手,但看起来很甜蜜,我很感激你提供的任何时候。

我目前在Mac OS X上使用Python3和Pygame(10.12.4)。我正在使用一些资源来回到我想要制作的一些街机游戏克隆。我昨天完成了所有工作,直到我重新安装OS X.在我的Mac上完成了干净的安装之后,我按照说明重新安装了Xcode,Homebrew,Python3和Pygame 1.9.4(也尝试了1.9.3)等。而且我遇到了一个奇怪的问题,我似乎无法找到相关信息。我在这里进行了一些研究,希望有人可以提供帮助。再次感谢!

$ python3 maze.py
ERROR: pygame.macosx import FAILED
ERROR: pygame.macosx import FAILED
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pygame/macosx.py", line 8, in <module>
    from pygame.pkgdata import getResource
  File "/usr/local/lib/python3.6/site-packages/pygame/pkgdata.py", line 27, in <module>
    from pkg_resources import resource_stream, resource_exists
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1022, in <module>
    class Environment(object):
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1025, in Environment
    def __init__(self, search_path=None, platform=get_supported_platform(),
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 267, in get_supported_platform
    plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
  File "/usr/local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 439, in _macosx_vers
    version = platform.mac_ver()[0]
AttributeError: module 'platform' has no attribute 'mac_ver'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "maze.py", line 298, in <module>
    main()
  File "maze.py", line 197, in main
    screen = pygame.display.set_mode([800, 600])
SystemError: <built-in function set_mode> returned a result with an error set
$ 

P.S。我应该能够回到今晚的任何答案,或明天的第一件事。

0 个答案:

没有答案