Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法在datalab中安装声音文件_Python_Google Cloud Datalab_Libsndfile - Fatal编程技术网

Python 无法在datalab中安装声音文件

Python 无法在datalab中安装声音文件,python,google-cloud-datalab,libsndfile,Python,Google Cloud Datalab,Libsndfile,我想安装sndfile以成功安装另一个软件包(musdb),但当我尝试在 它给了我以下错误: {Collecting sndfile Using cached https://files.pythonhosted.org/packages/db/ce/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz Requirement already satisfied: cffi>=1

我想安装sndfile以成功安装另一个软件包(musdb),但当我尝试在

它给了我以下错误:

{Collecting sndfile
 Using cached https://files.pythonhosted.org/packages/db/ce/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in /usr/local/envs/py2env/lib/python2.7/site-packages (from sndfile) (1.11.5)
Requirement already satisfied: pycparser in /usr/local/envs/py2env/lib/python2.7/site-packages (from cffi>=1.0.0->sndfile) (2.18)
Building wheels for collected packages: sndfile
Running setup.py bdist_wheel 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'))" bdist_wheel -d /tmp/pip-wheel-YWj7At --python-tag cp27:
running bdist_wheel
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
import musdb

OSErrorTraceback (most recent call last)

我试着在谷歌上搜索,它要么建议通过conda下载,这对于datalab来说似乎很困难,要么使用以下命令

sudo apt-get install libsndfile1
这给了我datalab中的语法错误


我需要此库,因为我正在尝试导入musdb,安装后,当我尝试导入时,它会给我以下错误:

{Collecting sndfile
 Using cached https://files.pythonhosted.org/packages/db/ce/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in /usr/local/envs/py2env/lib/python2.7/site-packages (from sndfile) (1.11.5)
Requirement already satisfied: pycparser in /usr/local/envs/py2env/lib/python2.7/site-packages (from cffi>=1.0.0->sndfile) (2.18)
Building wheels for collected packages: sndfile
Running setup.py bdist_wheel 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'))" bdist_wheel -d /tmp/pip-wheel-YWj7At --python-tag cp27:
running bdist_wheel
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
import musdb

OSErrorTraceback (most recent call last)

in。()
---->1进口musdb
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/__-init__.py-in()
1来自未来导入打印功能
---->2从音频类导入曲目、源、目标
3从操作系统导入路径作为op
从6.4开始导入地图
5导入多处理
/usr/local/envs/py2env/lib/python2.7/site-packages/musdb/audio_classes.py in()
2来自未来进口部
3导入操作系统
---->4将声音文件导入为sf
5作为np进口numpy
6.进口干燥剂
/usr/local/envs/py2env/lib/python2.7/site-packages/soundfile.py in()
140 _libname=_find_库('sndfile'))
141如果_libname为无:
-->142 raise OSError('sndfile library not found')
143 _snd=_ffi.dlopen(_libname)
144除操作错误外:
OS错误:找不到SND文件库

非常感谢您的任何见解

Datalab附带了conda,可在Python 2和3环境中使用。这意味着您应该能够通过以下方式获得所需:

%%bash
conda install -y libsndfile ffmpeg
pip install musdb
%%bash
conda install -y libsndfile ffmpeg
pip install musdb