我正在尝试在 Python 中运行音频文件:
from playsound import playsound
def main():
playsound('audio.mp3')
main()
但是,我不断收到以下错误:
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/playsound.py", line 55, in _playsoundOSX
from AppKit import NSSound
ImportError: No module named 'AppKit'
我在 macOS 10.12.6 上使用 Python 3.5.4。我尝试通过 pip 安装它,但返回此错误:
Using cached AppKit-0.2.8.tar.gz
Requirement already satisfied: flask in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (from appkit)
Collecting pygobject (from appkit)
Could not find a version that satisfies the requirement pygobject (from appkit) (from versions: )
No matching distribution found for pygobject (from appkit)