在谷歌Colab无法安装textract

3

我在Google Colab中无法安装textract,错误信息如下。

有些人建议使用sudo apt-get install libasound2-dev,但在Google Colab中如何执行sudo...

=== 错误消息 ==========================================================

为了pocketsphinx构建失败 运行pocketsphinx的setup.py无法为pocketsphinx 构建轮子 安装收集的包:pocketsphinx 正在运行pocketsphinx的setup.py install ...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

=========================================================================== 谢谢, Ling

2个回答

3

抱歉,您不能使用sudo,因为您无法获得Colab的root访问权限。

问题在于,您不仅需要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

我非常想点赞这个答案...你能帮忙解决与以下异常相关的问题吗:Building wheel for pocketsphinx (setup.py) ... error ERROR: Failed building wheel for pocketsphinx ? - Timothy Lombard

2

在 Google Colab 中,使用 Bash 命令需要在命令前加上 '!'。

例如:

!apt update
!apt-get install libasound2-dev

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接