从这里盗取:
需要先从conda (miniconda)安装swig。
conda install swig
然后从版本发布页面下载EbookLib 0.15的zip文件。
https://github.com/aerkalov/ebooklib/releases
在解压后,我手动使用记事本++从README.md文件中删除了Unicode字符(该Unicode字符位于第44行),然后使用pip安装了该模块。cd to_unzipped_folder_path_here
pip install .
最后
pip install textract
现在该项目似乎已被另一个人接管(在我写这篇答案的3个月前开始更新了该项目),因此解决方案要简单得多。
现在,您可以访问https://github.com/deanmalmgren/textract/releases并下载v1.6.2
,它仅提供比v1.6.1更高的需求更新(修复了Unicode调试错误),或者v1.6.3
是最新版本(截至撰写本文时)。
下载后,解压缩,cd [提取到的文件夹]
,然后pip install .
请记住,随着要求的更新,恶意代码可能会被插入依赖项中,因此请自行承担风险进行更新。
(Windows 10,Python 3.7) 我的问题比其他人更多,但这是基于以前的答案构建的:
确保已安装 Microsoft Visual Studio C++ Compiler for Python
python -m pip install --upgrade pip setuptools wheel
pip install six --upgrade
下载 EbookLib 版本 0.15:
下载 Swig:
从提示符中进入未压缩的 Ebooklib 文件夹:例如 C:> cd "C:\Users\username\Desktop\ebooklib-0.15"
运行 EbookLib 的安装:pip install .
运行 textract 安装:pip install textract
输出结果应该是:
C:\Users\username\Desktop\ebooklib-0.15>pip install textract
Collecting textract
Requirement already satisfied: docx2txt==0.6 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (0.6)
Requirement already satisfied: beautifulsoup4==4.5.3 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (4.5.3)
Requirement already satisfied: EbookLib==0.15 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (0.15)
Requirement already satisfied: xlrd==1.0.0 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (1.0.0)
Requirement already satisfied: SpeechRecognition==3.6.3 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (3.6.3)
Requirement already satisfied: six==1.10.0 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (1.10.0)
Collecting pocketsphinx==0.1.3 (from textract)
Using cached https://files.pythonhosted.org/packages/93/5f/a968e5d53d25e32deb78c3e169fd8612ecf53cc76e32cb40e19be35696af/pocketsphinx-0.1.3.tar.bz2
Requirement already satisfied: chardet==2.3.0 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (2.3.0)
Requirement already satisfied: argcomplete==1.8.2 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (1.8.2)
Requirement already satisfied: python-pptx==0.6.5 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from textract) (0.6.5)
Requirement already satisfied: lxml in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from EbookLib==0.15->textract) (4.3.3)
Requirement already satisfied: XlsxWriter>=0.5.7 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from python-pptx==0.6.5->textract) (1.1.8)
Requirement already satisfied: Pillow>=2.6.1 in c:\users\username\appdata\local\programs\python\python37\lib\site-packages (from python-pptx==0.6.5->textract) (6.0.0)
Building wheels for collected packages: pocketsphinx
Building wheel for pocketsphinx (setup.py) ... done
Stored in directory: C:\Users\username\AppData\Local\pip\Cache\wheels\38\80\4f\ddc3e8c2b788f2c7f1d625ae870f6bafd3038ff04a3445a2f8
Successfully built pocketsphinx
Installing collected packages: pocketsphinx, textract
Successfully installed pocketsphinx-0.1.3 textract-1.6.1
C:\Users\username\Desktop\ebooklib-0.15>
在撰写本文时,jsonschema与textract存在冲突的依赖关系。我尝试找到正确的安装方式时也出现了以下错误:
ERROR: requests 2.22.0 has requirement chardet<3.1.0,>=3.0.2, but you'll have chardet 2.3.0 which is incompatible.
ERROR: camelot-py 0.7.2 has requirement chardet>=3.0.4, but you'll have chardet 2.3.0 which is incompatible.
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pip-install-msmb9od3\EbookLib\
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1671: character maps to <undefined>
error: command 'C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python37\\swig.exe' failed with exit status 1
ERROR: Failed building wheel for pocketsphinx
error: command 'swig.exe' failed: No such file or directory
(1) : Error: Unable to find 'swig.swg'
(3) : Error: Unable to find 'python.swg'
pip install git+https://github.com/jpweytjens/textract