使用命令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:无法纠正问题,你已经破了包裹。
Thogh,我尝试使用'aptitude'安装,libpulse-dev已安装,但带有aptitude的textract错误是它无法找到该包。
答案 0 :(得分:2)
请安装以下内容:
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
答案 1 :(得分:0)
即使我遇到了与chardet版本冲突的python 3.5类似的问题,在该版本中,它要求的版本高于3.0.1,但由于多个库具有不同的版本,因此它的版本将达到2.3。 我通过创建虚拟环境来运行我的特定项目来解决该问题,如果您仅对特定任务有包装要求,那么应该采用这种方法。