我希望install sndfile成功地安装另一个包(musdb),但是当我尝试按照https://cloud.google.com/datalab/docs/how-to/adding-libraries上的说明操作时
!pip install sndfile
它给出了以下错误:
^{pr2}$Failed building wheel for sndfile
Running setup.py clean for sndfile
Failed to build sndfile
Installing collected packages: sndfile
Running setup.py install for sndfile ... error
Complete output from command /usr/local/envs/py2env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-NZx2D1/sndfile/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-FMQzpS/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/sndfile
copying sndfile/__init__.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/build.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/io.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/vio.py -> build/lib.linux-x86_64-2.7/sndfile
copying sndfile/formats.py -> build/lib.linux-x86_64-2.7/sndfile
running build_ext
generating cffi module 'build/temp.linux-x86_64-2.7/sndfile._sndfile.c'
creating build/temp.linux-x86_64-2.7
building 'sndfile._sndfile' extension
creating build/temp.linux-x86_64-2.7/build
creating build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7
gcc -pthread -B /usr/local/envs/py2env/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/envs/py2env/include/python2.7 -c build/temp.linux-x86_64-2.7/sndfile._sndfile.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/sndfile._sndfile.o
build/temp.linux-x86_64-2.7/sndfile._sndfile.c:494:21: fatal error: sndfile.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/envs/py2env/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-NZx2D1/sndfile/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-FMQzpS/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-NZx2D1/sndfile/}
我试着搜索一下,它要么建议通过conda下载,这在datalab中似乎很困难,要么使用下面的命令
sudo apt-get install libsndfile1
这给了我一个数据实验室的语法错误。在
我需要这个库,因为我正在尝试导入musdb,并且在安装之后,当我尝试导入时,它会给出以下错误:
import musdb
OSErrorTraceback (most recent call last)
在
in <module> . ()
----> 1 import musdb
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/__init__.py in <module>()
1 from __future__ import print_function
----> 2 from .audio_classes import Track, Source, Target
3 from os import path as op
4 from six.moves import map
5 import multiprocessing
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/audio_classes.py in <module>()
2 from __future__ import division
3 import os
----> 4 import soundfile as sf
5 import numpy as np
6 import stempeg
/usr/local/envs/py2env/lib/python2.7/site-packages/soundfile.py in <module>()
140 _libname = _find_library('sndfile')
141 if _libname is None:
--> 142 raise OSError('sndfile library not found')
143 _snd = _ffi.dlopen(_libname)
144 except OSError:
OSError: sndfile library not found
非常感谢您的任何见解!在
Datalab附带了conda,可以在python2和python3环境中使用。这意味着您应该能够通过以下方式获得所需:
相关问题 更多 >
编程相关推荐