debian安装网络自动设置失败

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了debian安装网络自动设置失败相关的知识,希望对你有一定的参考价值。

参考技术A 简介 初始安装完debian 7.7.0时,需要首先配置网络及apt-get源,才能正常使用。2 debian各个版本配置 2.1 debian 7.7.0配置网络及apt-get源...

为啥 pip 在 Debian 上安装 textract 失败?

【中文标题】为啥 pip 在 Debian 上安装 textract 失败?【英文标题】:Why is pip installing textract failing on Debian?为什么 pip 在 Debian 上安装 textract 失败? 【发布时间】:2019-01-21 03:18:24 【问题描述】:

我正在尝试在(dockerized)Debian 上安装 python 包 textract

FROM python:2.7
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install libevent-dev python-dev libxml2-dev libxslt1-dev antiword unrtf poppler-utils pstotext tesseract-ocr flac ffmpeg lame libmad0 libsox-fmt-mp3 sox libjpeg-dev swig
RUN pip install textract

但它在最后一步失败pip install textract。为什么?如何解决这个问题?以下是错误:

Building wheels for collected packages: textract, python-pptx, docx2txt, xlrd, EbookLib, pocketsphinx
  Running setup.py bdist_wheel for textract: started
  Running setup.py bdist_wheel for textract: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/7b/88/ca/fe02cca616f52ba41e11ee9eff08ca0d8391f3df35e0ede5e2
  Running setup.py bdist_wheel for python-pptx: started
  Running setup.py bdist_wheel for python-pptx: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/14/50/ec/bf4ff7cedffcde6ef29d3154f758a5d65f40427f526cbdb1d5
  Running setup.py bdist_wheel for docx2txt: started
  Running setup.py bdist_wheel for docx2txt: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/a8/a1/2e/61cea06f166c6f6ac4df4d75a409328406bd0d2f8e007592f9
  Running setup.py bdist_wheel for xlrd: started
  Running setup.py bdist_wheel for xlrd: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/f7/2e/62/b4b26f9bc16968996a93dab7a1ec3cf9a1c8ca409114f4fefe
  Running setup.py bdist_wheel for EbookLib: started
  Running setup.py bdist_wheel for EbookLib: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/3a/b9/cb/834288199b3b3c6c08441d5780ce4a6cfc161d4c859f28a915
  Running setup.py bdist_wheel for pocketsphinx: started
  Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/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-lmkSIP --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 -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/usr/local/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 -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/usr/local/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
   #include <pulse/pulseaudio.h>
                                ^
  compilation terminated.
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pocketsphinx
  Running setup.py clean for pocketsphinx
Successfully built textract python-pptx docx2txt xlrd EbookLib
Failed to build pocketsphinx
requests 2.20.0 has requirement chardet<3.1.0,>=3.0.2, but you'll have chardet 2.3.0 which is incompatible.
Installing collected packages: argcomplete, chardet, Pillow, XlsxWriter, python-pptx, docx2txt, beautifulsoup4, xlrd, six, EbookLib, SpeechRecognition, pocketsphinx, textract
  Found existing installation: chardet 3.0.4
    Uninstalling chardet-3.0.4:
      Successfully uninstalled chardet-3.0.4
  Found existing installation: beautifulsoup4 4.6.3
    Uninstalling beautifulsoup4-4.6.3:
      Successfully uninstalled beautifulsoup4-4.6.3
  Running setup.py install for pocketsphinx: started
    Running setup.py install for pocketsphinx: finished with status 'error'
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/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-MiPh8Y/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 -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/usr/local/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 -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/usr/local/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
     #include <pulse/pulseaudio.h>
                                  ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-rkBOkm/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-MiPh8Y/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-rkBOkm/pocketsphinx/
ERROR: Service 'baleen' failed to build: The command '/bin/sh -c pip install textract' returned a non-zero code: 1

【问题讨论】:

您的系统上似乎缺少 Pulseaudio 开发库。 请问如何获取? 找到它:apt-get -y install libpulse-dev Unable to install textract的可能重复 【参考方案1】:

解决方案: 在 pip 安装 textract 之前添加RUN apt-get -y install libpulse-dev

【讨论】:

【参考方案2】:

它清楚地显示了错误。

chardet 版本-=3.0.2 是必需的,但您有旧版本。

所以你需要卸载你的 chardet

sudo pip 列表 | grep chardet

然后卸载旧版本

sudo pip 卸载 chardet

【讨论】:

以上是关于debian安装网络自动设置失败的主要内容,如果未能解决你的问题,请参考以下文章

如何设置快速的debian源

debian

Debian 8(Xfce4) 不加载设置的环境变量的解决办法

Debian7 如何设置关闭盖子,继续保持运行?

debian安装教程 安装Debian步骤

【转.待验证】在OpenWRT上配置debian模式