Open
NewTrees
opened this issue 1 year ago
•
3 comments
Traceback (most recent call last):
File "d:/Users/Yum/Desktop/ofdtest.py", line 1, in
from easyofd import ofd2pdf
File "D:\ProgramData\PythonInstall\lib\site-packages\easyofd_init_.py", line 1, in
from .ofd import OFD
File "D:\ProgramData\PythonInstall\lib\site-packages\easyofd\ofd.py", line 16, in
import fitz
File "D:\ProgramData\PythonInstall\lib\site-packages\fitz_init_.py", line 2, in
from pymupdf import *
File "D:\ProgramData\PythonInstall\lib\site-packages\pymupdf_init_.py", line 29, in
from . import extra
File "D:\ProgramData\PythonInstall\lib\site-packages\pymupdf\extra.py", line 10, in
from . import _extra
ImportError: cannot import name 'extra' from partially initialized module 'pymupdf' (most likely due to a circular import) (D:\ProgramData\PythonInstall\lib\site-packages\pymupdf_init.py)
更新到3.11.6也是这个错误:Traceback (most recent call last):
File "d:\Users\Yum\Desktop\ofdtest.py", line 1, in
from easyofd import ofd2pdf
File "D:\ProgramData\PythonInstall\Lib\site-packages\easyofd_init_.py", line 1, in
from .ofd import OFD
File "D:\ProgramData\PythonInstall\Lib\site-packages\easyofd\ofd.py", line 16, in
import fitz
File "D:\ProgramData\PythonInstall\Lib\site-packages\fitz_init_.py", line 2, in
from pymupdf import *
File "D:\ProgramData\PythonInstall\Lib\site-packages\pymupdf_init_.py", line 29, in
from . import extra
File "D:\ProgramData\PythonInstall\Lib\site-packages\pymupdf\extra.py", line 10, in
from . import _extra
ImportError: cannot import name 'extra' from partially initialized module 'pymupdf' (most likely due to a circular import) (D:\ProgramData\PythonInstall\Lib\site-packages\pymupdf_init.py)
Note on the Name fitz
Old versions of PyMuPDF had their Python import name as fitz. Newer versions use pymupdf instead, and offer fitz as a fallback so that old code will still work.
The reason for the name fitz is a historical curiosity:
The original rendering library for MuPDF was called Libart.
“After Artifex Software acquired the MuPDF project, the development focus shifted on writing a new modern graphics library called “Fitz”. Fitz was originally intended as an R&D project to replace the aging Ghostscript graphics library, but has instead become the rendering engine powering MuPDF.” (Quoted from Wikipedia).
Note
Use of legacy name fitz can fail if defunct pypi.org package fitz is installed; see Problems after installation.