ModuleNotFoundError:没有名为"frontend"的模块 [英] ModuleNotFoundError: No module named 'frontend'

查看:2626
本文介绍了ModuleNotFoundError:没有名为"frontend"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了PymuPDF/fitz,但是在运行下面的示例代码后,我试图从PDF文件中提取图像

I have installed PymuPDF/fitz but upon running the sample code below, I am trying to extract images from PDF files

doc = fitz.open(pdf_path)
        for i in range(len(doc)):
            for img in doc.getPageImageList(i):
                xref = img[0]
                pix = fitz.Pixmap(doc, xref)
                if pix.n < 5:  # this is GRAY or RGB
                    pix.writePNG("p%s-%s.png" % (i, xref))
                else:  # CMYK: convert to RGB first
                    pix1 = fitz.Pixmap(fitz.csRGB, pix)
                    pix1.writePNG("p%s-%s.png" % (i, xref))
                    pix1 = None
                pix = None

它给了我以下错误,我进行了搜索,但是没有单个报告此类错误,我已经安装了PyMuPDF,muPDF和fitz模块

it gives me following error, i have searched but there isn't single report of this kind of error, i have installed PyMuPDF, muPDF and fitz modules

Traceback (most recent call last):
  File "/home/waqar/PycharmProjects/predator/ExtractFileImage.py", line 1, in <module>
    import fitz
  File "/home/waqar/anaconda3/envs/retinanet/lib/python3.6/site-packages/fitz/__init__.py", line 1, in <module>
    from frontend import *
ModuleNotFoundError: No module named 'frontend'

推荐答案

我通过以下方法解决了此问题:

I've solved it by:

pip install PyMuPDF

这篇关于ModuleNotFoundError:没有名为"frontend"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆