在Google Colab中安装Poppler以运行deepdoctection代码遇阻
在Google Colab运行deepdoctection示例代码时的Poppler缺失问题
我想在Google Colab中运行deepdoctection官方README里的示例代码:
import deepdoctection as dd from IPython.core.display import HTML from matplotlib import pyplot as plt analyzer = dd.get_dd_analyzer() # instantiate the built-in analyzer similar to the Hugging Face space demo df = analyzer.analyze(path = "/path/to/your/doc.pdf") # setting up pipeline df.reset_state() # Trigger some initialization doc = iter(df) page = next(doc) image = page.viz() plt.figure(figsize = (25,17)) plt.axis('off') plt.imshow(image)
但运行后触发如下错误:
/usr/local/lib/python3.10/dist-packages/deepdoctection/utils/pdf_utils.py in _input_to_cli_str(input_file_name, output_file_name, dpi, size) 160 command = "pdftocairo" 161 else: --> 162 raise PopplerNotFound("Poppler not found. Please install or add to your PATH.") 163 164 if platform.system() == "Windows": PopplerNotFound: Poppler not found. Please install or add to your PATH.
我试过相关安装方案,但都没有效果。
解决方案
在Google Colab中,直接通过以下命令安装Poppler即可:
!apt-get install -y poppler-utils
安装完成后,重新运行你的deepdoctection代码即可解决该错误。
内容的提问来源于stack exchange,提问作者lithium
相关产品推荐
相关产品推荐

