无法在 google colab 中安装 textract

Couldn't install textract in google colab

我无法在 google colab 中安装 textract,错误信息如下所示。

有些人建议使用sudo apt-get install libasound2-dev,但是如何在google colab 中使用sudo...

===错误信息======================================== ==================

Failed building wheel for pocketsphinx Running setup.py clean for pocketsphinx Failed to build pocketsphinx Installing collected packages: pocketsphinx Running setup.py install for pocketsphinx ... error Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-03c_ysbm/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-6n9ewg9i/install-record.txt --single-version-externally-managed --compile: running install running build_ext building 'sphinxbase._sphinxbase' extension swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c swig -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i unable to execute 'swig': No such file or directory error: command 'swig' failed with exit status 1

============================================= ============================== 谢谢, 玲

在 google colab Bash 命令中 运行 通过在命令前加上“!”作为前缀。

示例:

!apt update
!apt-get install libasound2-dev

不,您不能使用 sudo,因为您没有 root colab 访问权限。

问题是您不仅需要 libasound2-dev,还需要一大堆软件包。检查 https://textract.readthedocs.io/en/stable/installation.html

中的 debian 要求

另外,为了构建 sphinxtextract 的要求),您需要 libpulse-dev。所以这里是更新的命令列表。

!apt-get install python-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils \
     pstotext tesseract-ocr \
     flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig libasound2-dev libpulse-dev
!pip install git+https://github.com/deanmalmgren/textract