python - 无法在 google colab 中安装 textract

标签 python google-colaboratory text-extraction

我无法在 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

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

最佳答案

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

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

此外,为了构建 sphinx(textract 的要求),您需要 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

关于python - 无法在 google colab 中安装 textract,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54122807/

相关文章:

python - 如何修复 google colab 切割混淆矩阵图的问题

Python basemap 绘制大圆函数

python - 将 Google Cloud Datastore 与 NDB API 一起使用?

python - 比较Python中连续元组列表的第一个元素

python - 使用python从TXT文件中提取信息

Java 从文本文件中提取值

javascript - 从网页中提取提要

python - 返回 numpy 数组的函数上的 scipy.integrate.quad

python - Colab - python 代码中的 input() 框太长,所以我需要回滚才能阅读问题

google-colaboratory - Colaboratory 中的 Google Drive 未安装。暂停