【问题标题】:Unable to get page count. Is poppler installed and in PATH? on mac无法获取页数。 poppler 是否已安装并在 PATH 中?在 Mac 上
【发布时间】:2019-02-12 09:53:00
【问题描述】:

无法获取页数。 poppler 是否已安装并在 PATH 中?

poppler 已安装...重新安装 pdf2image 已安装....重新安装

注意: 拥有 Python 版本 3 和 2 使用 3...作为 python -V 在 3 上运行的代码

-----python代码

从 pdf2image 导入 convert_from_path pages = convert_from_path('dhl.pdf', 500)

位置也正确。

文件“/anaconda3/lib/python3.7/site-packages/pdf2image/pdf2image.py”,第 186 行,在 _page_count raise PDFInfoNotInstalledError('无法获取页数。是否已安装 poppler 并在 PATH 中?')

PDFInfoNotInstalledError:无法获取页数。 poppler 是否已安装并在 PATH 中?

【问题讨论】:

    标签: python-3.x poppler


    【解决方案1】:

    我遇到了同样的问题。 pdf2image 具有 Poppler 依赖项。

    你需要做的是以下。

     brew install poppler
    

    在你的 mac 终端中。

    【讨论】:

      【解决方案2】:

      brew install poppler之后你可以试试这个:

      pdf = convert_from_path('path/to/pdf')
      
      len(pdf) # this gives the count to the number of pages in pdf
      

      【讨论】:

        【解决方案3】:

        我遇到了同样的问题,我通过替换 poppler_path

        解决了

        来自

        poppler_path= '\usr\bin'   
        

        poppler_path= '\usr\local\bin'
        

        或尝试打印 poppler 可能在您的 mac 中的所有位置 通过echo $PATH 在终端中,并尝试poppler_path = 中的所有选项。

        【讨论】:

          猜你喜欢
          • 2022-08-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-11-25
          • 1970-01-01
          • 2018-06-23
          • 1970-01-01
          • 2021-09-15
          相关资源
          最近更新 更多