【问题标题】:UnicodeDecodeError installing EBookLib 0.15 for textract 1.6.1UnicodeDecodeError 为 textract 1.6.1 安装 EBookLib 0.15
【发布时间】:2019-03-02 23:22:03
【问题描述】:

我正在尝试使用 pip install textract 命令安装 textract,但出现以下错误。

C:\Users\HP\PycharmProjects\CVParser\venv\Scripts>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
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
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
Collecting beautifulsoup4==4.5.3 (from textract)
Using cached https://files.pythonhosted.org/packages/af/a3/9e803f838b3eeb313d45d916d4387cda8572c92e1aafeb53fd43ddb5da2c/beautifulsoup4-4.5.3-py3-none-any.whl
Collecting xlrd==1.0.0 (from textract)
Using cached https://files.pythonhosted.org/packages/0c/b0/8946fe3f9c2690c164aaa88dfd43b56347d3cdeac34124b988acd1aaa151/xlrd-1.0.0-py3-none-any.whl
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\HP\AppData\Local\Temp\pip-install-lk9fc36f\EbookLib\setup.py", line 13, in <module>
    long_description = open('README.md').read(),
  File "C:\Program Files\Python37\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\HP\AppData\Local\Temp\pip-install-lk9fc36f\EbookLib\
You are using pip version 10.0.1, however version 18.0 is available. You
should consider upgrading via the 'python -m pip install --upgrade
pip' command.

正如这里提到的,我使用 python -m pip install --upgrade pip 命令和 pip install --upgrade setuptools 成功升级了 pip。

另外通过link,我使用此命令 pip install -Iv ebooklib==0.15 安装了 EbookLib 0.15。然后它给了我以下异常。

Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-0fyox_v9\ebooklib\
Exception information:
Traceback (most recent call last):
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\basecommand.py", line 228, in main
    status = self.run(options, args)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\commands\install.py", line 291, in run
    resolver.resolve(requirement_set)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 103, in resolve
    self._resolve_one(requirement_set, req)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 257, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\resolve.py", line 210, in _get_abstract_dist_for
    self.require_hashes
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\operations\prepare.py", line 324, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\operations\prepare.py", line 154, in prep_for_dist
    self.req.run_egg_info()
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\req\req_install.py", line 486, in run_egg_info
    command_desc='python setup.py egg_info')
  File "c:\users\hp\pycharmprojects\cvparser\venv\lib\site-packages\pip-10.0.1-py3.7.egg\pip\_internal\utils\misc.py", line 698, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-install-0fyox_v9\ebooklib\

我正在使用 python 3.7.0pip 18.0

这是python版本的问题吗?谁能帮我解决这个问题?

【问题讨论】:

标签: python pip


【解决方案1】:

PyPi 上的textract 版本有EbookLib==0.15 作为要求,所以如果你非常想要那个版本,那么你必须从github 下载 Ebooklib 源代码 并编辑 README.md 使其不再包含 unicode 字符。

然而,更简单的方法是从its github page 下载最新版本的textract,因为Ebooklib 的要求已更改为EbookLib==0.16,从而解决了问题。

为此,只需下载源代码,进入目录并运行

pip install .

注意:由于您使用的是 venv,因此请确保您使用对应的 pip 版本运行它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    • 1970-01-01
    • 1970-01-01
    • 2019-06-04
    相关资源
    最近更新 更多