当我尝试在Python-3.10.1虚拟环境(使用Python-3.9.0 venv创建并升级)中使用PyAudio-0.2.11播放.wav文件时,我收到了一个异常并且没有声音输出,但其他部分都很好。
Exception in thread WavPlayer:rsrc/sound.wav:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/Code/py/tetris/tetris.py", line 39, in run
self.play()
File "/Code/py/tetris/tetris.py", line 35, in play
self.stream.write(data)
File "/Code/py/tetris/.venv/lib/python3.10/site-packages/pyaudio.py", line 584, in write
pa.write_stream(self._stream, frames, num_frames,
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
我不知道'#' format
代表什么,也确定我的代码与C API无关,但是它在python-3.9.x下运行良好,这是PyAudio库本身的问题吗?我该如何解决?