问题:我一直试图使用库pdf2image,我知道它需要事先安装。波普尔安装(通过自制)和包装通过pip。
但是,在运行convert_to_path(my_pdf)时,我得到以下信息:
Traceback (most recent call last):
File "<ipython-input-9-ba107659b495>", line 1, in <module>
test_image = convert_from_path(testfile,
File "/Users/<myuser>/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 97, in convert_from_path
page_count = pdfinfo_from_path(pdf_path, userpw, poppler_path=poppler_path)["Pages"]
File "/Users/<myuser>/.pyenv/versions/3.8.0/lib/python3.8/site-packages/pdf2image/pdf2image.py", line 467, in pdfinfo_from_path
raise PDFInfoNotInstalledError(
PDFInfoNotInstalledError: Unable to get page count. Is poppler installed and in PATH?My System:MacOC10.15.7 Python (通过自制) 3.8.0版
which python
/Users/<myuser>/.pyenv/shims/python
which pip
/Users/<myuser>/.pyenv/shims/pip到目前为止,我尝试过的是: Poppler是通过brew install poppler安装的,pdf2image是通过pip3 install pdf2image安装的,我也运行了brew cleanup。
试图使用以下命令强制使用convert_to_path中的poppler路径,
pop_path = "/usr/local/Cellar/poppler/21.03.0_1"
convert_to_path(my_pdf_file,poppler_path = pop_path)但还是会犯同样的错误。
在网上看了一眼,发现很多人都有相似的问题,但却不一样。我觉得我一定做错了什么,所以任何的指导都是很棒的。
发布于 2021-03-09 19:19:37
偏解?
在手动输入pop_path文件路径时,我忘记将/bin附加到路径中,
pop_path = "/usr/local/Cellar/poppler/21.03.0_1/bin"密码现在起作用了。虽然我的骄傲需要一段时间才能恢复。
我觉得我可能还坐在一个糟糕的配置问题上?关于类似问题的许多帖子似乎暗示了一个自制的安装-popper不应该有这个问题。可能是因为我也在用pyenv吗?
https://stackoverflow.com/questions/66553004
复制相似问题