想跑的脚本代码报错在 'ssl.pyi' 中找不到引用 '_create_unverified_context',网上查了一下说是因为没有安装好PyAudio这个包。在Pycharm里直接安装报错了一大堆如下:
问题描述Using cached PyAudio-0.2.11.tar.gz (37 kB) Preparing metadata (setup.py): started Preparing metadata (setup.py): finished with status 'done' Using legacy 'setup.py install' for PyAudio, since package 'wheel' is not installed. Installing collected packages: PyAudio Running setup.py install for PyAudio: started Running setup.py install for PyAudio: finished with status 'error' error: subprocess-exited-with-error Running setup.py install for PyAudio did not run successfully. exit code: 1 [19 lines of output] running install running build running build_py creating build creating buildlib.win-amd64-3.9 copying srcpyaudio.py -> buildlib.win-amd64-3.9 warning: build_py: byte-compiling is disabled, skipping. ...... PyAudio note: This is an issue with the package mentioned above, not pip. hint: See above for output from the failure.
报错的原因在这句:
error: command 'D:。。。X86\x64\cl.exe' failed with exit code 2
大概是VS环境没配干净哈哈。。。
于是使用源文件.whl 直接pip,但是报错platform不支持,很奇怪,明明安装的就是对应的版本。
下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
解决方法 1于是将命令改为py -3.9 -m pip install PyAudio-0.2.11-cp39-cp39-win_amd64.whl,命令行显示安装成功。
2将.whl文件改为.zip解压到python的Lib里。
然后把PyAudio环境加到项目环境里去就行。



