OS X ver。 10.11.6
;Pygame:pygame.error:無法打開文件.ogg
Python3 ver。 stable 3.5.2 (bottled), devel 3.6.0rc1, HEAD
(通過Homebrew);
Pygame ver。 homebrew/python/pygame: stable 1.9.2a0, HEAD
(pip3 and Homebrew將得到同樣的錯誤,我會在下面說明);
Xcode ver。 Xcode 8.2
Build version 8C38
。
在終端I運行:
python3 BattleCity.py
,其中(BattleCity.py)是遊戲的源代碼,和pygame的模塊在它導入。
以下是終端結果:(爲了便於閱讀,我重新安排壓痕,並添加/刪除一些不可見的字符)
2016-12-18 21:26:12.739 Python[1600:53113] 21:26:12.739
WARNING:140:
This application, or a library it uses, is using the deprecated Carbon Component
Manager for hosting Audio Units.
Support for this will be removed in a future release.
Also, this makes the host incompatible with version 3 audio units.
Please transition to the API's in AudioComponent.h.
Traceback (most recent call last):
File "BattleCity.py", line 2074, in <module>
game = Game()
File "BattleCity.py", line 1266, in __init__
sounds["start"] = pygame.mixer.Sound("sounds/gamestart.ogg")
pygame.error: Unable to open file 'sounds/gamestart.ogg'
我已經經歷了一些相關的問題,但他們的解決方案搜索不工作。
在文件我已經使用pygame.init()
,但仍然是相同的錯誤,所以我不知道上面的兩個錯誤是否有關?