问题描述
在按照官方教程安装完成以后,执行 python -c "import mindspore"
, 报一下错:
[WARNING] ME(9662:140307555661632,MainProcess):2021-10-28-20:46:21.685.307 [mindspore/run_check/_check_version.py:181] Cuda [‘10.1’, ‘11.1’] version(need by mindspore-gpu) is not found, please confirm that the path of cuda is set to the env LD_LIBRARY_PATH, please refer to the installation guidelines: https://www.mindspore.cn/install
解决方案
首先确定需要安装cuda10.1或者11.1,然后修改用户主目录下的 .bashrc文件:
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH="/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/home/xx/anaconda3/envs/py37/lib:$LD_LIBRARY_PATH"
其中最关键的是最后一行,将你构建环境的lib添加在LD_LIBRARY_PATH环境变量中。
修改完成以后别忘了source一下生效:
source ~/.bashrc
然后重新启动环境测试:
source activate py37
python -c "import mindspore"