无法降级numpy以兼容librosa 0.8.1的技术问题求助
问题:librosa 0.8.1兼容性问题及安装报错解决
初始兼容性报错
因业务兼容性要求必须使用librosa 0.8.1,执行pip install librosa==0.8.1完成安装后,将其导入项目时触发numpy相关错误:
AttributeError: module 'numpy' has no attribute 'complex'. `np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here. The aliases was originally deprecated in NumPy 1.20.
可见librosa 0.8.1与自动安装的numpy 1.26.4存在兼容性冲突,该问题虽在librosa 0.9.x版本中已修复,但当前必须保留librosa 0.8.1版本。
降级numpy时的新问题
尝试执行pip uninstall numpy卸载现有版本后,安装numpy==1.19.2,却出现以下报错:
ModuleNotFoundError: No module named 'setuptools.extern.six'
后续尝试了以下操作,均触发相同错误:
pip install --upgrade numpy==1.19.2pip install --force-reinstall numpy==1.19.2- 使用pip3安装numpy 1.19.5
- 通过
python -m pip执行安装操作(本机仅安装Python 3.12.2 x64版本)
且已提前安装了最新版setuptools。
求助需求
目前不确定应当从setuptools方向入手解决该安装报错,还是存在无需降级numpy即可正常使用librosa 0.8.1的解决方案,希望获得可行的解决办法。
内容的提问来源于stack exchange,提问作者Dawn
相关产品推荐
相关产品推荐

