完美解决AttributeError: type object ‘h5py.h5r.Reference‘ has no attribute ‘reduce_cython‘
文章目录
- 报错问题
- 解决方法
- T1、更新Cython 库、scipy库
- T2、直接更新h5py库
- T3、降低h5py库的版本
- 声明
报错问题
之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:
AttributeError: type object ‘h5py.h5r.Reference‘ has no attribute ‘reduce_cython‘
File "f:\program files\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
File "h5py\h5r.pxd", line 21, in init h5py._conv
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "f:\program files\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 714, in load_module
module = loader.load_module(fullname)
File "h5py\h5r.pyx", line 145, in init h5py.h5r
AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__'
[25780] Failed to execute script CV_Object
没有该属性,一般都是版本不兼容引起的!
解决方法
T1、更新Cython 库、scipy库
很可能是Cython 0.26与python3不兼容,更新Cython 库、scipy库
T2、直接更新h5py库
conda update h5py
T3、降低h5py库的版本
pip install h5py==2.7.0
声明
解决方法参考网络,如有侵权联系我删除