本文介绍了没有名为 AppKit 的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 Python 中运行音频文件:
I am trying to run an audio file in Python:
from playsound import playsound
def main():
playsound('audio.mp3')
main()
但是,我不断收到以下错误:
However, I keep getting the following error:
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 安装它,但返回此错误:
I am using Python 3.5.4 on macOS 10.12.6. I have tried installing it via pip but I am returned this error:
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)
推荐答案
如果你想使用AppKit你必须安装PyObjC:
If you want to use AppKit you have to install PyObjC:
pip3 install -U PyObjC
或
pip install -U PyObjC
这篇关于没有名为 AppKit 的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!