python - pip install pdfminer 错误(Windows 上的 python 2)
问题描述
当我在 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.
这曾经有效......我不知道如何解决这个问题。
解决方案
最近 pdfminer放弃了对 Python 2 的支持。
您可以尝试使用pdfminer.six,这是 pdfminer 的一个分支,它同时支持 Python 2 和 3。但是,对 Python 2 的支持将在 2020 年 1 月停止,因此它只会为您购买几个月。
全面披露:我是 pdfminer.six 的维护者之一。
推荐阅读
- php - 如何通过数组的值过滤我的学说请求?
- gradle - 如何在 Java 中使用 Tensorflow lite?
- gradle - 梯度异常。未找到 Flutter SDK
- android - 从类到活动使用 startActivityForResult
- windows - 从位于子模块中的目标构建安装程序
- java - 为什么我的 ArrayList 只打印出最后一个被调用的子类?
- fortran - 如果在 fortran 77 中使用算术
- spring - 如何使用 ExceptionHandler 在 Spring Boot Rest 中包装 Path Not Found 异常?
- r - 在 R 中提炼一个简单的代码,一切正常,我想完善它
- python - 用 openpyxl 将单元格值的一部分替换为空白