如何在python3中安装textract

时间:2017-11-25 06:30:53

标签: python-3.5 text-extraction

sudo python3 -m pip install textract
sudo apt-get install textract
pip install textract
sudo apt-get install swig

我想在python3中安装textract但是它没有正确安装,它会出现以下错误。

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -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
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -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
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

3 个答案:

答案 0 :(得分:5)

请按照以下步骤操作:

  1. 从以下网址下载textract的源文件:https://pypi.python.org/pypi/textract

  2. pip3安装pdfminer3k

  3. 解压缩下载的文件

  4. 进入目录

  5. 运行:python3 setup.py install

  6. 这对我有用:)

答案 1 :(得分:4)

您需要先在Ubuntu中安装libpulse-dev或在Fedora中安装pulseaudio-libs-devel

  • 如果您在Ubuntu,请尝试sudo apt-get install libpulse-dev
  • 如果您在Fedora,请尝试sudo dnf install pulseaudio-libs-devel

至少这对我有用。

答案 2 :(得分:0)

首先在conda中安装pip。 python -m pip install --upgrade pip

然后安装textract,pip install textract