PyCharm - ImportError: libcurand.so.8.0: cannot open shared object file: No such file or directory

PyCharm - ImportError: libcurand.so.8.0: cannot open shared object file: No such file or directory

终端 (Terminal) 命令执行正常,PyCharm 中执行报错:ImportError: libcurand.so.8.0: cannot open shared object file: No such file or directory。

1. cat ~/.bashrc

确保环境变量设置正常。

strong@foreverstrong:~$ cat ~/.bashrc
......
# foreverstrong cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

2. ll /usr/local/cuda*

确保 CUDA - cuDNN 安装正常。

strong@foreverstrong:~$ ll /usr/local/cuda*
lrwxrwxrwx  1 root root   19 Oct 15 20:14 /usr/local/cuda -> /usr/local/cuda-8.0/

/usr/local/cuda-10.0:
total 80
drwxr-xr-x 19 root root 4096 Oct 15 19:54 ./
drwxr-xr-x 12 root root 4096 Oct 15 20:14 ../
drwxr-xr-x  3 root root 4096 Oct 15 19:54 bin/
drwxr-xr-x  5 root root 4096 Oct 15 19:53 doc/
drwxr-xr-x  5 root root 4096 Oct 15 19:54 extras/
drwxr-xr-x  6 root root 4096 Oct 15 20:27 include/
drwxr-xr-x  5 root root 4096 Oct 15 19:53 jre/
drwxr-xr-x  3 root root 4096 Oct 15 20:32 lib64/
drwxr-xr-x  8 root root 4096 Oct 15 19:53 libnsight/
drwxr-xr-x  7 root root 4096 Oct 15 19:53 libnvvp/
drwxr-xr-x  8 root root 4096 Oct 15 19:54 NsightCompute-1.0/
drwxr-xr-x  2 root root 4096 Oct 15 19:53 nsightee_plugins/
drwxr-xr-x  3 root root 4096 Oct 15 19:53 nvml/
drwxr-xr-x  7 root root 4096 Oct 15 19:53 nvvm/
drwxr-xr-x  2 root root 4096 Oct 15 19:54 pkgconfig/
drwxr-xr-x 11 root root 4096 Oct 15 19:54 samples/
drwxr-xr-x  3 root root 4096 Oct 15 19:53 share/
drwxr-xr-x  2 root root 4096 Oct 15 19:53 src/
drwxr-xr-x  2 root root 4096 Oct 15 19:53 tools/
-rw-r--r--  1 root root   22 Oct 15 19:54 version.txt

/usr/local/cuda-8.0:
total 72
drwxr-xr-x 17 root root 4096 Oct 15 20:14 ./
drwxr-xr-x 12 root root 4096 Oct 15 20:14 ../
drwxr-xr-x  3 root root 4096 Oct 15 20:14 bin/
drwxr-xr-x  5 root root 4096 Oct 15 20:14 doc/
drwxr-xr-x  5 root root 4096 Oct 15 20:14 extras/
drwxr-xr-x  5 root root 4096 Oct 15 20:18 include/
drwxr-xr-x  5 root root 4096 Oct 15 20:14 jre/
drwxr-xr-x  3 root root 4096 Oct 15 20:21 lib64/
drwxr-xr-x  8 root root 4096 Oct 15 20:14 libnsight/
drwxr-xr-x  7 root root 4096 Oct 15 20:14 libnvvp/
drwxr-xr-x  3 root root 4096 Oct 15 20:14 nvml/
drwxr-xr-x  7 root root 4096 Oct 15 20:14 nvvm/
drwxr-xr-x  2 root root 4096 Oct 15 20:14 pkgconfig/
drwxr-xr-x 11 root root 4096 Oct 15 20:14 samples/
drwxr-xr-x  3 root root 4096 Oct 15 20:14 share/
drwxr-xr-x  2 root root 4096 Oct 15 20:14 src/
drwxr-xr-x  2 root root 4096 Oct 15 20:14 tools/
-rw-r--r--  1 root root   20 Oct 15 20:14 version.txt
strong@foreverstrong:~$

3. PyCharm 没有继承终端设置的环境变量

通过桌面快捷方式打开 PyCharm,PyCharm 没有继承终端设置的环境变量。

3.1. 解决方法 1

在 PyCharm 中针对项目设置环境变量。每创建一个项目,都需要设置一下 PyCharm 环境变量。

Run -> Edit Configurations -> Environment -> Environment Variables 添加 LD_LIBRARY_PATH 内容,即可解决问题

在这里插入图片描述

3.2. 解决方法 2

终端打开的 PyCharm 会继承 .bashrc 中设置的环境变量。

PyCharm 安装目录 /home/strong/software/pycharm-2016.3.3,执行 /home/strong/software/pycharm-2016.3.3/bin 目录下的 pycharm.sh 脚本打开 pycharm 继承终端设置的环境变量。

strong@foreverstrong:~$ /home/strong/software/pycharm-2016.3.3/bin/pycharm.sh
strong@foreverstrong:~$

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yongqiang Cheng

梦想不是浮躁,而是沉淀和积累。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值