本文介绍了librosa:仅使用克隆git正确安装,并且尽管导入但不能使用任何功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python的新手,总体来说还是编程,并且我目前正在努力安装和使用librosa库.我以为我成功安装了:

I'm quite a newbie with python, and programming in general, and I am currently struggling with installing and using the library librosa.I thought I succeeded installing it with:

git clone https://github.com/librosa/librosa.git librosa

并分别安装numpy和scipy,再次使用:

and also with installing numpy and scipy seperately, again with:

git clone https://github.com/numpy/numpy.git numpy
git clone https://github.com/scipy/scipy.git scipy

,它似乎终于可以工作了.我还可以:

and it seemed to finally work. I could also:

import librosa

没有任何问题,但我尝试使用:

without any problems, but as I tried to use:

librosa.load(pathfile, y, sr) 

或:

filename = librosa.util.example_audio_file()

我收到错误消息:

Traceback (most recently call last):
File "home/pi/new version.py", line 17, in <module> 
slowbeat_lib = librosa.load('home/pi/gpio-music-box/samples/slowbeat.ogg', y, sr=None)
Attribute Error: module 'librosa'has no attribute 'load'

与以下相同:

librosa.util

所以,我想我可能没有完全安装它,也没有在正确的目录中安装它,因为它不在 usr/lib 中,而是在 home/pi/中. ...

So, I was thinking that I probably didn't install it completely, or in the right directory, because it is not in the usr/lib, but in home/pi/...

我试图改变它,但是失败了.还可以通过以下方式安装它:

I tried to change that, but failed. Also installing it with:

pip install

sudo pip install

从来没有解决过,因为它总是无法为一些侧面包装(例如numpy,scipy,llvmlite ,...)制造轮子.->这也很奇怪,对吧?

never worked out, because it always failed to build wheels for several side packages such as numpy, scipy, llvmlite,... --> That's also quite weird, right?

还是这个问题可能完全不同?

Or could the problem be something totally different?

因此,实际上我很无助,感谢任何提示或建议! :)

So actually I am quite helpless, and thankful for any hint or advice! :)

推荐答案

从某种意义上说,当您安装librosa时,它将在scipy/numpy/llvmlite上失败. pip将自动尝试安装librosa的依赖项.

It makes that sense that when you install librosa it would fail on scipy/numpy/llvmlite. pip will automatically try to install the dependencies for librosa.

您肯定要使用pip进行安装. librosa的github存储库没有打包在一起,它是为使用librosa代码而不是将其用作库的人们准备的.

You definitely want to install using pip. The github repo of librosa is not packaged the same, and it's meant for people working on librosa code, rather than using it as a library.

在树莓派系统上,pip install --user librosa是您想要的.

On a raspberry-pi system, pip install --user librosa is what you want.

请记住,某些python软件包只是C代码的包装.当您pip install llvmlite时,您只是在安装包装器.

Keep in mind that some of the python packages are just wrappers around C code. When you pip install llvmlite you're just installing the wrapper.

我会在此处针对类似问题查看此答案: https://stackoverflow.com/a/46840976/564872

I'd look at this answer on a similar question here: https://stackoverflow.com/a/46840976/564872

特别是这行:sudo apt install libblas-dev llvm python3-pip python3-scipy(假设您使用的是python3)

specifically the line:sudo apt install libblas-dev llvm python3-pip python3-scipy (assuming that you're using python3)

这篇关于librosa:仅使用克隆git正确安装,并且尽管导入但不能使用任何功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 21:47