安装webrtcvad出现ERROR: Failed building wheel for webrtcvad【解决办法】

今天爱分享给大家带来安装webrtcvad出现了gcc的问题【解决办法】,希望能够帮助到大家。

今天使用下面的命令安装webrtcvad的时候出现了下面的问题,命令为:

pip install webrtcvad

错误信息为:

(base) ➜  ~ pip install webrtcvad
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting webrtcvad
  Downloading http://mirrors.aliyun.com/pypi/packages/89/34/e2de2d97f3288512b9ea56f92e7452f8207eb5a0096500badf9dfd48f5e6/webrtcvad-2.0.10.tar.gz (66kB)
     |████████████████████████████████| 71kB 696kB/s
Building wheels for collected packages: webrtcvad
  Building wheel for webrtcvad (setup.py) ... error
  ERROR: Complete output from command /Users/admin/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-install-hy22jowz/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-wheel-5v9raxcm --python-tag cp37:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.7
  copying webrtcvad.py -> build/lib.macosx-10.7-x86_64-3.7
  running build_ext
  building '_webrtcvad' extension
  creating build/temp.macosx-10.7-x86_64-3.7
  creating build/temp.macosx-10.7-x86_64-3.7/cbits
  creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc
  creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio
  creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio/signal_processing
  creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio/vad
  /usr/local/Cellar/gcc/9.2.0/bin/gcc-9 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/admin/anaconda3/include -arch x86_64 -I/Users/admin/anaconda3/include -arch x86_64 -DWEBRTC_POSIX -Icbits -I/Users/admin/anaconda3/include/python3.7m -c cbits/pywebrtcvad.c -o build/temp.macosx-10.7-x86_64-3.7/cbits/pywebrtcvad.o
  unable to execute '/usr/local/Cellar/gcc/9.2.0/bin/gcc-9': No such file or directory
  error: command '/usr/local/Cellar/gcc/9.2.0/bin/gcc-9' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for webrtcvad
  Running setup.py clean for webrtcvad
Failed to build webrtcvad
Installing collected packages: webrtcvad
  Running setup.py install for webrtcvad ... error
    ERROR: Complete output from command /Users/admin/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-install-hy22jowz/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-record-m4llx73p/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.7
    copying webrtcvad.py -> build/lib.macosx-10.7-x86_64-3.7
    running build_ext
    building '_webrtcvad' extension
    creating build/temp.macosx-10.7-x86_64-3.7
    creating build/temp.macosx-10.7-x86_64-3.7/cbits
    creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc
    creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio
    creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio/signal_processing
    creating build/temp.macosx-10.7-x86_64-3.7/cbits/webrtc/common_audio/vad
    /usr/local/Cellar/gcc/9.2.0/bin/gcc-9 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/admin/anaconda3/include -arch x86_64 -I/Users/admin/anaconda3/include -arch x86_64 -DWEBRTC_POSIX -Icbits -I/Users/admin/anaconda3/include/python3.7m -c cbits/pywebrtcvad.c -o build/temp.macosx-10.7-x86_64-3.7/cbits/pywebrtcvad.o
    unable to execute '/usr/local/Cellar/gcc/9.2.0/bin/gcc-9': No such file or directory
    error: command '/usr/local/Cellar/gcc/9.2.0/bin/gcc-9' failed with exit status 1
    ----------------------------------------
ERROR: Command "/Users/admin/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-install-hy22jowz/webrtcvad/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-record-m4llx73p/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/5h/mjbc_z1n7m91q21xw9_m217m0000gn/T/pip-install-hy22jowz/webrtcvad/

解决方法
发现是gcc出现问题了,于是重新安装gcc

brew search gcc
brew install gcc

装了之后我发现是gcc9.2,于是加入环境变量:

sudo vim ~/.zshrc

用户可能是bashrc,我这里由于装了zsh,环境变量文件变成了zshrc,用户可以自己打开自己的bashrc。

alias gcc='gcc-9'
alias cc='gcc-9'
alias g++='g++-9'
alias c++='c++-9'

然后命令行输入:

source ~/.zshrc

然后就可以重新安装了:

(base) ➜  ~ pip install webrtcvad
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting webrtcvad
  Downloading http://mirrors.aliyun.com/pypi/packages/89/34/e2de2d97f3288512b9ea56f92e7452f8207eb5a0096500badf9dfd48f5e6/webrtcvad-2.0.10.tar.gz (66kB)
     |████████████████████████████████| 71kB 642kB/s 
Building wheels for collected packages: webrtcvad
  Building wheel for webrtcvad (setup.py) ... done
  Stored in directory: /Users/admin/Library/Caches/pip/wheels/f5/90/4c/296ccd2e89848899bd357d5e596d88f7b9bf180f3ec8c5b326
Successfully built webrtcvad
Installing collected packages: webrtcvad
Successfully installed webrtcvad-2.0.10

人已赞赏
Python

Could not import the PyAudio C module '_portaudio'. Reason: image not found【解决办法】

2020-11-15 11:35:25

Python

Deep Learning 深度学习 中文版免费下载地址【学习必备】

2020-11-16 13:44:12

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
'); })();