我在 Mac 上玩弄 pyspotify,我一直在阅读示例和文档。我下载了一个示例应用程序(pyspotify git repo 中的 jukebox.py 示例),当我从命令行运行它时,我得到以下信息:
Traceback (most recent call last):
File "jukebox.py", line 15, in <module>
AudioSink = import_audio_sink()
File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 45, in import_audio_sink
raise ImportError, "\n".join(error_messages)
ImportError: Tried to use spotify.audiosink.alsa.AlsaSink as audio sink, but failed:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink
module = __import__(module, fromlist=[cls])
File "/Library/Python/2.7/site-packages/spotify/audiosink/alsa.py", line 1, in <module>
import alsaaudio
ImportError: No module named alsaaudio
Tried to use spotify.audiosink.oss.OssSink as audio sink, but failed:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink
module = __import__(module, fromlist=[cls])
File "/Library/Python/2.7/site-packages/spotify/audiosink/oss.py", line 1, in <module>
import ossaudiodev
ImportError: No module named ossaudiodev
Tried to use spotify.audiosink.portaudio.PortAudioSink as audio sink, but failed:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink
module = __import__(module, fromlist=[cls])
File "/Library/Python/2.7/site-packages/spotify/audiosink/portaudio.py", line 1, in <module>
import pyaudio
ImportError: No module named pyaudio
Tried to use spotify.audiosink.gstreamer.GstreamerSink as audio sink, but failed:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/spotify/audiosink/__init__.py", line 36, in import_audio_sink
module = __import__(module, fromlist=[cls])
File "/Library/Python/2.7/site-packages/spotify/audiosink/gstreamer.py", line 3, in <module>
import gobject
ImportError: No module named gobject
Was not able to import any of the audio sinks
我知道不存在各种音频 API/源的 python 包装器,但是我怎么知道我是否需要/如何安装 gobject 或 pyaudio 及其支持 API?我尝试了 pyaudio,但它失败了,因为我没有它所包含的库(我认为)。有没有人得到这个?谢谢!