无法在Windows上安装textract

时间:2018-06-07 14:25:00

标签: python windows package install python-packaging

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

我收到以下错误:

error

我不知道该怎么做,所以我真的很感激任何建议。 谢谢

4 个答案:

答案 0 :(得分:9)

here被盗:

需要首先从conda(miniconda)安装swig

conda install swig

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

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

解压缩后,我手动删除(我使用了notepad ++)README.md文件中的unicode char。 (unicode字符位于第44行)

然后使用pip安装该模块。

cd to_unzipped_folder_path_here
pip install .

最后

pip install textract

答案 1 :(得分:0)

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

  1. 确保已安装用于Python的Microsoft Visual Studio C ++编译器

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

  3. pip安装六个--upgrade

  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 \ Programs \ 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. cd从提示符进入解压缩的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'

答案 2 :(得分:0)

既然该项目似乎已由另一个人接管(最近写的答案是3个月前,当我撰写此答案时,最近又开始更新该项目),解决方案就更加简单了。

您现在可以转到https://github.com/deanmalmgren/textract/releases并下载v1.6.2,它仅提供v1.6.1上的要求更新(修复了unicode调试错误)或最新的v1.6.3(在撰写本文时)这个。)

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

请紧记,始终存在着这样的担忧,即随着需求的更新,恶意代码可能会插入到依赖项中,并自行承担风险。

答案 3 :(得分:0)

这不是最优雅的解决方案,但它可以工作!

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

感谢jpweytjens