尝试在Google Colab上安装pyaudio,但出现错误“错误:pyaudio的构建轮失败”。
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools
!pip install pyaudio
我收到此错误:
Collecting pyaudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Failed building wheel for pyaudio
Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-000dzv_9/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-tvs_aja7/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-000dzv_9/pyaudio/
答案 0 :(得分:0)
我只需要从libav-tools
中删除apt install
,然后再次运行此命令即可。
!apt install libasound2-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg
现在pyaudio已成功安装。
答案 1 :(得分:0)
在Ubuntu 20.04计算机上发现Python安装后,我很高兴按照这些步骤进行操作。在Ubuntu 18.04上易于安装的某些库未在20.04上安装,因为可能会发生某些依赖关系问题。正确安装Python后,我可以避免任何pyaudio问题。
仅在Ubuntu计算机上进行了测试:
sudo apt-get update
sudo apt-get install -y build-essential checkinstall
答案 2 :(得分:0)
在Ubuntu 20.04计算机上发现Python安装后,请按照以下步骤进行操作。在Ubuntu 18.04上易于安装的某些库未在20.04上安装,因为可能会发生某些依赖性问题。在正确安装Python之后,我可以避免出现任何PyAudio问题。
仅在Ubuntu计算机上进行了测试:
1- sudo apt-get更新
2- sudo apt-get install -y构建基本检查安装
3- sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
我将从/ usr / src安装它,但是您可以使用您选择的任何位置:
4-cd / usr / src sudo wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
**Extracting downloaded package:**
5- sudo tar xzf Python-3.6.9.tgz
**Compiling Source:**
6- cd Python-3.6.9 7- sudo ./configure-启用优化
**Building python:**
8- sudo make altinstall
**Verify Installation:**
9- python3.6 --version
升级点数(可选): 10-安装pip依赖项 sudo apt-get install -y python3-distutils python3-testresources
**Downloading get-pip.py and running:**
11- cd〜/ wget https://bootstrap.pypa.io/get-pip.py 须藤python3.6 get-pip.py
12- 是否要使用别名?
别名py36 = python3.6 别名pip36 = pip3.6
**使用update-alternatives **
检查您的python路径,以将其添加到update-alternatives配置:
13-哪个python3.6
我的路径是/usr/local/bin/python3.6 将路径添加到update-alternatives配置:
14-sudo update-alternatives --install / usr / bin / python python /usr/local/bin/python3.6 0
15-sudo apt安装libasound2-dev portaudio19-dev libportaudio2 ibportaudiocpp0 ffmpeg
16- pip安装pyaudio
### Lycka直到###