我已经安装了 PymuPDF/fitz,因为我试图从 PDF 文件中提取图像。但是,在运行下面的代码时,我看到No module named 'frontend'
.
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 模块
这是完整的错误:
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'