Could not load dynamic library ‘libcudart.so.11.0‘

原文来自:https://github.com/tensorflow/tensorflow/issues/45930#issuecomment-770342299
我这里大致翻译以下。
I has same problem ,and solved this problem by those step.
我遇到了同样的问题,用以下步骤解决
First, find out where the “libcudart.so.11.0” is
找出libcudart.so.11.0所在
If you lost other at error stack, you can replace the “libcudart.so.11.0” by your word in below:
可以用以下命令找出

sudo find / -name 'libcudart.so.11.0'

作者以上命令比较慢,我这里用

locate libcudart.so.11.0

Output in my system.This result shows where the “libcudart.so.11.0” is in my system:
我找到了这个文件就在下面这个位置

/usr/local/cuda-11.1/targets/x86_64-linux/lib/libcudart.so.11.0

If the result shows nothing, please make sure you have install cuda or other staff that must install in your system.
如果没有找到,请确认你是否安装了cuda
Second, add the path to environment file.
然后增加一个路径在这里 /etc/profile

sudo vim /etc/profile
append path to "LD_LIBRARY_PATH" in profile file
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.1/targets/x86_64-linux/lib

make environment file work

source /etc/profile

Last, when it all done, you can try your python code again.
Hope it help for you!

At the end
I do every thing on guide list to install tensorflow. But still occurs the same problem
my environment:
ubuntu: 20.04LTS
tensorflow: 2.4.1
python3: 3.8
pip3: 21
CUDA: 11.1
cuDNN: 8.1.0
GPU: GeForce GTX 860M
GPU Driver: 460.39

My error stack before solve this problem:

2021-01-31 15:04:10.925736: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:10.925774: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-01-31 15:04:11.738577: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-01-31 15:04:11.771425: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-01-31 15:04:11.771969: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1770] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 860M computeCapability: 5.0
coreClock: 1.0195GHz coreCount: 5 deviceMemorySize: 1.96GiB deviceMemoryBandwidth: 74.65GiB/s
2021-01-31 15:04:11.772084: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772174: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcublas.so.11’; dlerror: libcublas.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772255: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcublasLt.so.11’; dlerror: libcublasLt.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772333: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcufft.so.10’; dlerror: libcufft.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772413: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcurand.so.10’; dlerror: libcurand.so.10: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772490: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcusolver.so.11’; dlerror: libcusolver.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772567: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcusparse.so.11’; dlerror: libcusparse.so.11: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: :/usr/local/cuda/extras/CUPTI/lib64
2021-01-31 15:04:11.772745: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.8
2021-01-31 15:04:11.772763: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1803] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices…
After I fix it , the python code works fine

你可能感兴趣的:(cuda)