Importlib behaves differently when importing pyd file

Jach Feng jfong at ms4.hinet.net
Wed Nov 16 21:58:58 EST 2022


Dieter Maurer 在 2022年11月17日 星期四凌晨1:12:20 [UTC+8] 的信中寫道:
> Jach Feng wrote at 2022-11-15 22:52 -0800: 
> >My working directory d:\Works\Python\ has a package 'fitz' looks like this: 
> > 
> >....fitz\ 
> >........__init__.py 
> >........fitz.py 
> >........utils.py 
> >........_fitz.pyd 
> > 
> >There is a statement in fitz.py: 
> >....return importlib.import_module('fitz._fitz') 
> > 
> >It works fine under Python 3.4 interpreter: 
> >>>> import fitz 
> >>>> 
> > 
> >But under Python 3.8 I get an exception: 
> >>>> import fitz 
> >Traceback(... 
> >... 
> >... 
> >ImportError: DLL load failed while importing _fitz 
> >>>>
> The Python C-API is Python version dependent. 
> Your `_fitz.pyd` may need to be recreated for Python 3.8.
It seems that I have to install pymupdf to use fitz. Thank you.


More information about the Python-list mailing list