我正在尝试使用pyAudioAnalysis库从mp3文件中提取功能。我遇到的问题是我无法让我的Jupyter笔记本找到eyed3,这对于图书馆来说是必不可少的。这是我的代码:
from pyAudioAnalysis import audioBasicIO
from pyAudioAnalysis import audioFeatureExtraction
import matplotlib.pyplot as plt
[Fs, x] = audioBasicIO.readAudioFile("/Users/Kyle/Downloads/sample.rickyxsan - Insane.mp3");
F = audioFeatureExtraction.stFeatureExtraction(x, Fs, 0.050*Fs, 0.025*Fs);
plt.subplot(2,1,1); plt.plot(F[0,:]); plt.xlabel('Frame no'); plt.ylabel('ZCR');
plt.subplot(2,1,2); plt.plot(F[1,:]); plt.xlabel('Frame no'); plt.ylabel('Energy'); plt.show()
当我运行时,我收到此错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-d4b751ae9dc8> in <module>()
1 # GETTING FEATURES
2
----> 3 from pyAudioAnalysis import audioBasicIO
4 from pyAudioAnalysis import audioFeatureExtraction
5 import matplotlib.pyplot as plt
/Users/Kyle/Documents/School/Projects/SoundcloudProject/Tools/pyAudioAnalysis/audioBasicIO.py in <module>()
----> 1 import os, glob, eyed3, ntpath, shutil, numpy
2 import scipy.io.wavfile as wavfile
3 import pydub
4 from pydub import AudioSegment
5
ImportError: No module named eyed3
当我尝试“sudo pip install eyed3”时,我得到了这个输出:
Requirement already satisfied: eyed3 in /anaconda/lib/python3.5/site-packages
Requirement already satisfied: six in /anaconda/lib/python3.5/site-packages (from eyed3)
Requirement already satisfied: python-magic in /anaconda/lib/python3.5/site-packages (from eyed3)
Requirement already satisfied: pathlib in /anaconda/lib/python3.5/site-packages (from eyed3)
当我尝试“brew install eyed3”时,我明白了:
Warning: git-2.11.0 already installed, it's just not linked.
Error: Git must be installed and in your PATH!
Warning: eye-d3-0.7.8 already installed
看起来好像已经安装了eyed3,但我不知道如何让我的笔记本找到它。
答案 0 :(得分:0)
cel是对的,看起来安装你的库的解释器与jupyter正在使用的解释器不同。这是有道理的,因为你正在做sudo pip安装,而不仅仅是pip install。我猜这个库是通过链接的一个版本安装的,管理员可以访问,但不是你的本地帐户。
尝试使用以下其中一项:
python -m pip install eyed3
或
pip install eyed3 --user
也可能是你的jupyter笔记本正在使用的环境是使用conda设置的。在这种情况下使用:
conda install eyed3