【python报错】Intel MKL FATAL ERROR: Cannot load mkl/../../../libmkl_rt.so.2.

python报错:

Intel MKL FATAL ERROR: Cannot load mkl/../../../libmkl_rt.so.2.

在这里插入图片描述
在切换旧版numpy版本的时候,出现了这个报错,表现就是将numpy切换到<1.24的版本的时候,只要import numpy就弹出以上报错。

尝试了网上的各种方法,包括update conda,重新install numpy,重新install mkl,修改LD_LIBRARY_PATH,表现还是一样。

因为必须要用低版本numpy,就继续尝试。最终解决方案如下:

解决方案

pip index versions mkl
pip install "mkl==某个低版本"

再安装numpy到你想要的版本,如果提示mkl版本太低,会自动升级的。

问题原因

分析一下,原因其实就是旧版numpy和新版mkl不兼容的问题。虽然都卸载了,但是在重新安装numpy低版的时候,conda没能自动匹配到合适的mkl,所以先手动装一个低版的mkl,让他们之间再次联动起来。

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
The error message you encountered indicates that there is an issue loading the Intel Math Kernel Library (MKL) dynamic library file `libmkl_rt.so.1` in your Python environment. This error can occur due to various reasons, such as incorrect installation or configuration issues. Here are a few steps you can try to resolve the issue: 1. Check MKL Installation: Ensure that Intel MKL is properly installed on your system. You can visit the official Intel website and follow the instructions to download and install the MKL library for your operating system. 2. Verify Library Path: Confirm that the library path specified in the error message (`/opt/anaconda3/lib/python3.10/site-packages/mkl/../../../libmkl_rt.so.1`) is correct. It should point to the location of the `libmkl_rt.so.1` file on your system. Make sure the file exists at that location. 3. Update LD_LIBRARY_PATH: Set the `LD_LIBRARY_PATH` environment variable to include the directory where the `libmkl_rt.so.1` file is located. You can do this by running the following command before executing your Python script: ``` export LD_LIBRARY_PATH=/path/to/mkl:$LD_LIBRARY_PATH ``` Replace `/path/to/mkl` with the actual directory path containing the `libmkl_rt.so.1` file. 4. Conda Environment Activation: If you are using Anaconda or Miniconda, try activating your conda environment before running the Python script. This ensures that the correct MKL libraries associated with your environment are loaded. 5. Reinstall Libraries: If the above steps do not resolve the issue, you can try reinstalling the relevant libraries, including NumPy, MKL, and any other packages that depend on them. You can use the following commands: ``` conda uninstall numpy mkl conda install numpy mkl ``` This will uninstall and then reinstall the NumPy and MKL libraries using conda. If the issue still persists after trying these steps, it would be helpful to provide more information about your system configuration, the specific steps you followed during the installation, and any additional error messages or traceback information you received.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值