繁体   English   中英

无法在Windows上安装textract

[英]Can't install textract on windows

当我尝试使用pip命令在我的Windows上安装textract软件包时,我尝试了很多东西但仍然失败了。

我收到以下错误:

错误

我不知道该怎么做,所以我会非常感激任何建议。 谢谢

这里来的

需要先从conda(miniconda)安装swig

conda install swig

然后从发行版下载了EbookLib 0.15 zip

https://github.com/aerkalov/ebooklib/releases

解压后,我手动删除(我使用notepad ++)README.md文件中的unicode char。 (unicode char在44行)

然后用pip安装模块。

cd to_unzipped_folder_path_here
pip install .

最后

pip install textract

(Windows 10,Python 3.7)我遇到了比其他问题更多的问题,但这是基于以前的答案:

  1. 确保安装了Microsoft Visual Studio C ++ Compiler for Python

  2. python -m pip install --upgrade pip setuptools wheel

  3. pip安装六 - 升级

  4. 下载EbookLib版本0.15:

    • 解压缩.zip文件为避免编码错误,请将“long_description”变量赋值编辑为“long_description = open('README.md',encoding =”utf-8“)。read(),”
  5. 下载Swig:

    • http://www.swig.org/download.html
    • 解压缩.zip文件
    • 将swig.exe文件复制到Python路径中:例如“C:\\ Users \\ username \\ AppData \\ Local \\ Programs \\ Python \\ Python37”
    • 将“typemaps”文件夹复制到python“Lib”文件夹中:例如“C:\\ Program Files \\ swigwin-4.0.0 \\ Lib \\ typemaps” - >“C:\\ Users \\ username \\ AppData \\ Local \\ Programs \\ Python \\ Python37 \\ LIB \\”
    • 将“* .swg”文件复制到python“Lib”文件夹:例如“C:\\ Program Files \\ swigwin-4.0.0 \\ Lib * .swg” - >“C:\\ Users \\ username \\ AppData \\ Local \\程序\\ Python的\\ Python37 \\ LIB \\”
    • 将所有swig python文件复制到python“Lib”文件夹:例如“C:\\ Program Files \\ swigwin-4.0.0 \\ Lib \\ python *” - >“C:\\ Users \\ username \\ AppData \\ Local \\ Programs \\ Python的\\ Python37 \\ LIB \\”
  6. 从提示符进入解压缩的Ebooklib文件夹:例如C:> cd“C:\\ Users \\ username \\ Desktop \\ ebooklib-0.15”

  7. 运行EbookLib的安装:pip install。

  8. 运行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'

由于该项目似乎已由另一个人接管,因此解决方案要简单得多(最近3个月前,当我写下这个答案时,我们再次开始更新项目。)

您现在可以访问https://github.com/deanmalmgren/textract/releases并下载v1.6.2 ,它仅提供v1.6.1(修复unicode调试错误)或v1.6.3 (最新版本)的需求更新(截至写这个。)

下载后,解压缩, cd [folder extracted to]pip install .

请记住,始终存在这样的担忧:随着需求的更新,恶意代码可以插入到依赖项中并更新此风险,风险自负。

不是最优雅的解决方案但它的工作原理!

pip install git+https://github.com/jpweytjens/textract

感谢jpweytjens

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM