【问题标题】:pip install pdfminer error (python 2 on Windows)pip install pdfminer 错误(Windows 上的 python 2)
【发布时间】:2019-10-30 01:48:42
【问题描述】:

当我在 Windows Server 2012 上使用 Python 2.7 运行 pip install pdfminer 时,出现以下错误:

Running setup.py install for pdfminer ... error
ERROR: Command errored out with exit status 1:
 command: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\admini~1\\appdata\\local\\temp\\2\\pip-install-xgbxsi\\pdfminer\\setup.py'"'"'; __file__='"'"'c:\\users\\admin
i~1\\appdata\\local\\temp\\2\\pip-install-xgbxsi\\pdfminer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'
"'exec'"'"'))' install --record 'c:\users\admini~1\appdata\local\temp\2\pip-record-mdl997\install-record.txt' --single-version-externally-managed --compile
     cwd: c:\users\admini~1\appdata\local\temp\2\pip-install-xgbxsi\pdfminer\
Complete output (24 lines):
running install
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\users\admini~1\appdata\local\temp\2\pip-install-xgbxsi\pdfminer\setup.py", line 71, in <module>
    'Topic :: Text Processing',
  File "c:\python27\lib\site-packages\setuptools\__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "c:\python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\users\admini~1\appdata\local\temp\2\pip-install-xgbxsi\pdfminer\setup.py", line 11, in run
    from pdfminer.cmapdb import convert_cmap
  File "pdfminer\cmapdb.py", line 22, in <module>
    from .psparser import PSStackParser
  File "pdfminer\psparser.py", line 4, in <module>
    from .utils import choplist
  File "pdfminer\utils.py", line 219, in <module>
    0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
  File "pdfminer\utils.py", line 187, in <genexpr>
    PDFDocEncoding = ''.join(chr(x) for x in (
ValueError: chr() arg not in range(256)
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\admini~1\\appdata\\local\\temp\\2\\pip-install-xgbxsi\\pdfminer\\setup.py'"'"
'; __file__='"'"'c:\\users\\admini~1\\appdata\\local\\temp\\2\\pip-install-xgbxsi\\pdfminer\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close()
;exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\admini~1\appdata\local\temp\2\pip-record-mdl997\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

这曾经可以工作......我不知道如何解决这个问题。

【问题讨论】:

    标签: python pip pdfminer


    【解决方案1】:

    最近pdfminer dropped the support for Python 2。

    您可以尝试使用pdfminer.six,这是一个支持 Python 2 和 3 的 pdfminer 的分支。但是,对 Python 2 的支持将在 2020 年 1 月停止,所以它只会给你买几个月.

    完全披露:我是 pdfminer.six 的维护者之一。

    【讨论】:

    • 创建一个只能使用几个月的新项目 (pdfminer.six) 有什么意义?这只是一个诚实的问题:我认为整合六种用法肯定需要做很多工作,现在对 Python2 的支持被放弃了……那么与最初的 pdfminer 相比,2020 年的项目有什么意义?再说一次,我只是好奇原因
    • 它已经存在几年了。
    猜你喜欢
    • 2018-11-21
    • 2015-07-21
    • 1970-01-01
    • 2019-12-27
    • 2017-04-24
    • 1970-01-01
    • 1970-01-01
    • 2017-12-06
    • 1970-01-01
    相关资源
    最近更新 更多