运行python web.py的时候报错
OSError: sndfile library not found
使用pip install sndfile 安装相应包,报错日志如下
Looking in indexes: https://pypi.mirrors.ustc.edu.cn/simple/
Collecting sndfile
Downloading https://mirrors.bfsu.edu.cn/pypi/web/packages/db/ce/797cacd78490aa9de2e0e119491079d380e2fbbd7a1c5057c9fb2120a643/sndfile-0.2.0.tar.gz (4.3 kB)
Requirement already satisfied: cffi>=1.0.0 in /home/hunan/miniconda3/envs/mocking/lib/python3.7/site-packages (from sndfile) (1.15.0)
Requirement already satisfied: pycparser in /home/hunan/miniconda3/envs/mocking/lib/python3.7/site-packages (from cffi>=1.0.0->sndfile) (2.21)
Building wheels for collected packages: sndfile
Building wheel for sndfile (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/hunan/miniconda3/envs/mocking/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';file='"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-kv129kjw
cwd: /tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/
Complete output (23 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/sndfile
copying sndfile/vio.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/formats.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/init.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/io.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/build.py -> build/lib.linux-x86_64-3.7/sndfile
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.7/sndfile._sndfile.c'
creating build/temp.linux-x86_64-3.7
building 'sndfile._sndfile' extension
creating build/temp.linux-x86_64-3.7/build
creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
gcc -pthread -B /home/hunan/miniconda3/envs/mocking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hunan/miniconda3/envs/mocking/include/python3.7m -c build/temp.linux-x86_64-3.7/sndfile._sndfile.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/sndfile._sndfile.o
build/temp.linux-x86_64-3.7/sndfile._sndfile.c:571:10: fatal error: sndfile.h: No such file or directory
#include <sndfile.h>
^~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
ERROR: 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
ERROR: Command errored out with exit status 1:
command: /home/hunan/miniconda3/envs/mocking/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';file='"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ezhwkiaq/install-record.txt --single-version-externally-managed --compile --install-headers /home/hunan/miniconda3/envs/mocking/include/python3.7m/sndfile
cwd: /tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/
Complete output (25 lines):
running install
/home/hunan/miniconda3/envs/mocking/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
setuptools.SetuptoolsDeprecationWarning,
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/sndfile
copying sndfile/vio.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/formats.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/init.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/io.py -> build/lib.linux-x86_64-3.7/sndfile
copying sndfile/build.py -> build/lib.linux-x86_64-3.7/sndfile
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.7/sndfile._sndfile.c'
creating build/temp.linux-x86_64-3.7
building 'sndfile._sndfile' extension
creating build/temp.linux-x86_64-3.7/build
creating build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7
gcc -pthread -B /home/hunan/miniconda3/envs/mocking/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/hunan/miniconda3/envs/mocking/include/python3.7m -c build/temp.linux-x86_64-3.7/sndfile._sndfile.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/sndfile._sndfile.o
build/temp.linux-x86_64-3.7/sndfile._sndfile.c:571:10: fatal error: sndfile.h: No such file or directory
#include <sndfile.h>
^~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
ERROR: Command errored out with exit status 1: /home/hunan/miniconda3/envs/mocking/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';file='"'"'/tmp/pip-install-8ywejwpr/sndfile_b713bf1471364fbaa57702a47f955b06/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code,file, '"'"'exec'"'"'))' install --record /tmp/pip-record-ezhwkiaq/install-record.txt --single-version-externally-managed --compile --install-headers /home/hunan/miniconda3/envs/mocking/include/python3.7m/sndfile Check the logs for full command output.
1条答案
按热度按时间iovurdzv1#
不知道你搞定没有,我的mac m1 安装好了,web.py跑步起来。
这个错误我正好做了笔记,
首先安装brew install libsndfile, 或者apt-get 安装,
然后找到 libsndfile的头文件和lib目录,执行这个:
CFLAGS="-I/opt/homebrew/Cellar/libsndfile/1.1.0/include" LDFLAGS="-L/opt/homebrew/Cellar/libsndfile/1.1.0/lib" pip install sndfile。
项目启动后继续报错找不到 libsndfile.dylib,这个是因为我本地安装的目录在homebrew目录里,做个软链就好了。