pip - 无法安装文本

标签 pip nlp sentiment-analysis text-extraction pdf-reader

使用命令pip install textract我无法在 Ubuntu 16.04、Python 2 上安装 textract。

我收到以下错误:

Collecting textract
Requirement already satisfied: python-pptx==0.6.5 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.6.5)
Requirement already satisfied: docx2txt==0.6 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.6)
Requirement already satisfied: six==1.10.0 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.10.0)
Requirement already satisfied: xlrd==1.0.0 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.0.0)
Requirement already satisfied: beautifulsoup4==4.5.3 in ./anaconda2/lib/python2.7/site-packages (from textract) (4.5.3)
Requirement already satisfied: argcomplete==1.8.2 in ./anaconda2/lib/python2.7/site-packages (from textract) (1.8.2)
Requirement already satisfied: EbookLib==0.15 in ./anaconda2/lib/python2.7/site-packages (from textract) (0.15)
Collecting pocketsphinx==0.1.3 (from textract)
  Using cached https://files.pythonhosted.org/packages/93/5f/a968e5d53d25e32deb78c3e169fd8612ecf53cc76e32cb40e19be35696af/pocketsphinx-0.1.3.tar.bz2
Collecting chardet==2.3.0 (from textract)
  Using cached https://files.pythonhosted.org/packages/7e/5c/605ca2daa5cf21c87690d8fe6ab05a6f2278c451f4ede6456dd26453f4bd/chardet-2.3.0-py2.py3-none-any.whl
Requirement already satisfied: SpeechRecognition==3.6.3 in ./anaconda2/lib/python2.7/site-packages (from textract) (3.6.3)
Requirement already satisfied: Pillow>=2.6.1 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (5.0.0)
Requirement already satisfied: XlsxWriter>=0.5.7 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (1.0.2)
Requirement already satisfied: lxml>=3.1.0 in ./anaconda2/lib/python2.7/site-packages (from python-pptx==0.6.5->textract) (4.1.1)
Building wheels for collected packages: pocketsphinx
  Running setup.py bdist_wheel for pocketsphinx ... error
  Complete output from command /home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/pocketsphinx/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-JVTDy9 --python-tag cp27:
  running bdist_wheel
  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 -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/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 -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/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 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pocketsphinx
  Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
boto3 1.7.6 requires botocore<1.11.0,>=1.10.6, which is not installed.
s3transfer 0.1.13 requires botocore<2.0.0,>=1.3.0, which is not installed.
grin 1.2.1 requires argparse>=1.1, which is not installed.
tensorflow-gpu 1.2.0 has requirement markdown==2.2.0, but you'll have markdown 2.6.11 which is incompatible.
requests 2.18.4 has requirement chardet<3.1.0,>=3.0.2, but you'll have chardet 2.3.0 which is incompatible.
Installing collected packages: pocketsphinx, chardet, textract
  Running setup.py install for pocketsphinx ... error
    Complete output from command /home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/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-record-Dy07hO/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 -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/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 -B /home/satyam/anaconda2/compiler_compat -Wl,--sysroot=/ -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DSPHINXBASE_EXPORTS -DPOCKETSPHINX_EXPORTS -DSPHINX_DLL -DHAVE_CONFIG_H -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -I/home/satyam/anaconda2/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 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/satyam/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-L5494L/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-record-Dy07hO/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-L5494L/pocketsphinx/

当我尝试 sudo apt-get install libpulse-dev 时,出现以下错误:

以下软件包具有未满足的依赖关系: libpulse-dev :依赖:libglib2.0-dev 但不会安装它 E:无法纠正问题,您持有破损的包裹。

不过,我尝试使用“aptitude”进行安装,libpulse-dev 已安装,但是带有 aptitude 的 texttract 的错误是它无法找到该包。

最佳答案

请安装以下内容:

sudo apt-get install libglib2.0-0=2.48.0-1ubuntu4
sudo apt-get install libglib2.0-dev
sudo apt-get install libpulse-dev
sudo apt-get install swig
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-de

如果上面的命令不起作用,也没关系

sudo easy_install greenlet
sudo easy_install gevent
pip install textract

关于pip - 无法安装文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50421921/

相关文章:

django - 运行 django-cms 演示页面时出现错误

python - pip install 生成错误 : Command errored out with exit status 1

Ubuntu 上的 Python PIP

python - 对文本进行标记和标签

python - 通过pip安装成功后找不到命令

nlp - Gensim 的 word2vec 从 epoch 1 开始损失为 0?

java - 如何使用java对属于特定区域的字符串进行分类?

machine-learning - Sentiwordnet 3.0 结果意味着什么?

java - 斯坦福 nlp 的情感分析不起作用

machine-learning - 情感分析的最佳预处理技术是什么?