解决 AttributeError: 'NoneType' object has no attribute 'split' 错误 - OpenBLAS 与 threadpoolctl 库兼容性问题

在 Python 中使用 threadpoolctl 库时,你可能会遇到以下错误:

File "D:\Anaconda\lib\site-packages\threadpoolctl.py", line 646, in _OpenBLASModule.get_version
    config = get_config().split()
AttributeError: 'NoneType' object has no attribute 'split'

这个错误是因为在调用 get_config() 方法时返回了 None 对象,而 None 对象没有 split() 方法,因此报错。

解决方法:

  1. 检查 OpenBLAS 库是否已正确安装:

    • 如果你没有安装 OpenBLAS 库,则需要安装它。可以使用 conda install openblaspip install openblas 进行安装。
  2. 确保 OpenBLAS 库的版本与 threadpoolctl 库兼容:

    • 如果 OpenBLAS 库的版本不兼容,则需要更新 OpenBLAS 库或降级 threadpoolctl 库版本。
    • 你可以使用 conda list openblaspip show openblas 检查 OpenBLAS 库的版本。
    • 你可以使用 conda update openblaspip install --upgrade openblas 更新 OpenBLAS 库。
    • 你可以使用 pip install threadpoolctl==X.X.X 安装指定版本的 threadpoolctl 库。

总结:

AttributeError: 'NoneType' object has no attribute 'split' 错误通常是由于 OpenBLAS 库未正确安装或版本不兼容导致的。通过检查 OpenBLAS 库的安装情况和版本兼容性,可以解决此错误。

解决 AttributeError: 'NoneType' object has no attribute 'split' 错误 - OpenBLAS 与 threadpoolctl 库兼容性问题

原文地址: https://www.cveoy.top/t/topic/n6A1 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录