我无法在Windows 10上安装Textract

时间:2018-10-22 21:52:20

标签: python-3.x windows-10 ocr

我正在尝试在Windows 10计算机上为OCR项目安装textract,但是当使用 pip install textract 时,安装将失败,并显示以下错误消息:

(OcrEnv) C:\Users\Toshiba>pip install textract
Collecting textract
  Using cached https://files.pythonhosted.org/packages/e0/00/a9278b3672a31da06394eb588a16e96f8fce9f6ae0ed44cca18103d4aef5/textract-1.6.1.tar.gz
Collecting argcomplete==1.8.2 (from textract)
  Using cached https://files.pythonhosted.org/packages/f0/0f/f965f1520e6ba24b63320919eecfbe3d03debd32402e0c61a08e8fa02d17/argcomplete-1.8.2-py2.py3-none-any.whl
Requirement already satisfied: chardet==2.3.0 in c:\users\toshiba\anaconda3\lib\site-packages (from textract) (2.3.0)
Collecting python-pptx==0.6.5 (from textract)
  Using cached https://files.pythonhosted.org/packages/f8/9c/30bc244cedc571307efe0780d8195ffed5b08f09c94d23f50d6d5144ebc7/python-pptx-0.6.5.tar.gz
Collecting docx2txt==0.6 (from textract)
  Using cached https://files.pythonhosted.org/packages/aa/72/f02730ec3b0219d8f783a255416339b02ff8b6a300c817abf0505833212a/docx2txt-0.6.tar.gz
Requirement already satisfied: beautifulsoup4==4.5.3 in c:\users\toshiba\anaconda3\lib\site-packages (from textract) (4.5.3)
Requirement already satisfied: xlrd==1.0.0 in c:\users\toshiba\anaconda3\lib\site-packages (from textract) (1.0.0)
Collecting EbookLib==0.15 (from textract)
  Using cached https://files.pythonhosted.org/packages/04/30/2cbf65fa9587a1ecc66a78eea91f9189ead8fdadd5e009115bce34529aa6/EbookLib-0.15.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-y9tbwmrn\EbookLib\setup.py", line 13, in <module>
        long_description = open('README.md').read(),
      File "c:\users\toshiba\anaconda3\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1671: character maps to <undefined>

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-install-y9tbwmrn\EbookLib\

我们将不胜感激任何帮助。

1 个答案:

答案 0 :(得分:1)

似乎是textract依赖项之一ebooklib的问题。 textract要求完全 0.15版。本期中描述的解决方法是安装CondaSwig,然后在自述文件中清理Unicode字符,以便pip可以构建可以使用的0.15版本:

# Run in Python 3.x
with open(r"C:\Users\franc\OneDrive\Pukeko\EbookLib-0.15\README.md", "rb") 
as f:
    text = f.read().decode('ascii', 'replace')

with open(r"C:\Users\franc\OneDrive\Pukeko\EbookLib-0.15\README.md", "w") 
as f:
    print(text, file=f)

您将需要适当地更改这些路径以匹配您的计算机。

其他人在使它起作用时遇到了一些困难,因此您可能需要在该问题中询问是否继续遇到问题。

Issue is here.