我正在尝试安装一个 Python 包,textract
但收到了提及的错误pulseaudio.h
。
我尝试安装 textract 时出现的确切错误是:
$ sudo pip install textract
Collecting textract
Using cached textract-1.6.1.tar.gz
Requirement already satisfied: argcomplete==1.8.2 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: chardet==2.3.0 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: python-pptx==0.6.5 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: docx2txt==0.6 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: beautifulsoup4==4.5.3 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: xlrd==1.0.0 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: EbookLib==0.15 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: SpeechRecognition==3.6.3 in /usr/local/lib/python2.7/site-packages (from textract)
Requirement already satisfied: six==1.10.0 in /usr/local/lib/python2.7/site-packages (from textract)
Collecting pocketsphinx==0.1.3 (from textract)
Using cached pocketsphinx-0.1.3.zip
Requirement already satisfied: lxml>=3.1.0 in /usr/local/lib64/python2.7/site-packages (from python-pptx==0.6.5->textract)
Requirement already satisfied: Pillow>=2.6.1 in /usr/local/lib64/python2.7/site-packages (from python-pptx==0.6.5->textract)
Requirement already satisfied: XlsxWriter>=0.5.7 in /usr/local/lib/python2.7/site-packages (from python-pptx==0.6.5->textract)
Requirement already satisfied: olefile in /usr/local/lib/python2.7/site-packages (from Pillow>=2.6.1->python-pptx==0.6.5->textract)
Installing collected packages: pocketsphinx, textract
Running setup.py install for pocketsphinx ... error
Complete output from command /usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JU_tHz/pocketsphinx/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-XW683a-record/install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/swig
creating build/temp.linux-x86_64-2.7/swig/sphinxbase
creating build/temp.linux-x86_64-2.7/deps
creating build/temp.linux-x86_64-2.7/deps/sphinxbase
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src
creating build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/include/python2.7 -c swig/sphinxbase/ad_wrap.c -o build/temp.linux-x86_64-2.7/swig/sphinxbase/ad_wrap.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/usr/include/python2.7 -c deps/sphinxbase/src/libsphinxad/ad_pulse.c -o build/temp.linux-x86_64-2.7/deps/sphinxbase/src/libsphinxad/ad_pulse.o -Wno-unused-label -Wno-strict-prototypes -Wno-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-result -Wno-sign-compare -Wno-misleading-indentation
deps/sphinxbase/src/libsphinxad/ad_pulse.c:44:30: fatal error: pulse/pulseaudio.h: No such file or directory
#include <pulse/pulseaudio.h>
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JU_tHz/pocketsphinx/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-XW683a-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-JU_tHz/pocketsphinx/
谷歌搜索提到要安装libpulse-dev
,所以我尝试运行sudo yum install libpulse-dev
,但它说它不可用。该命令的输出是:
Loaded plugins: priorities, update-motd, upgrade-helper
No package libpulse-dev available.
Error: Nothing to do
我现在有点不知道该尝试什么
答案1
您需要先libpulse-dev
在 Ubuntu 或pulseaudio-libs-devel
Fedora 中安装。
- 如果你使用的是 Ubuntu,请尝试
sudo apt-get install libpulse-dev
- 如果你使用的是 Fedora,请尝试
sudo dnf install pulseaudio-libs-devel
至少这对我有用。