简体   繁体   English

无法正确导入具有GPU支持的Tensoflow

[英]can't import tensoflow with GPU support correctly

my python version is 2.7.12 我的python版本是2.7.12

cuda version is 9.0 cuda版本是9.0

cudnn version is 7.0 cudnn版本是7.0

and my OS is ubuntu 16.04 而我的操作系统是ubuntu 16.04

but when I import tensorflow , I have get the follow error message. 但是当我导入tensorflow时,我收到以下错误消息。

how I can solve it! 我该怎么解决!

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory ImportError:libcusolver.so.8.0:无法打开共享对象文件:没有此类文件或目录

Failed to load the native TensorFlow runtime. 无法加载本地TensorFlow运行时。

See https://www.tensorflow.org/install/install_sources#common_installation_problems 请参阅https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. 出于某些常见原因和解决方案。 Include the entire stack trace above this error message when asking for help. 寻求帮助时,在此错误消息上方包括整个堆栈跟踪。

I had these issues in past. 我以前有这些问题。 Please specify the tensorflow version you are trying to install. 请指定您要安装的tensorflow版本。 These are the possible solutions you can try: 您可以尝试以下解决方案:

Solution 1 - 解决方案1-

  1. Check if Cuda path is set in your ~/.bashrc file, It should be something like this export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 检查您的〜/ .bashrc文件中是否设置了Cuda路径,应该类似于以下export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64\\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

  2. You should be able to run nvcc -V 您应该能够运行nvcc -V

  3. If everything looks correct sometime you can solve the problem by just changing cuda-9.0 to just cuda in the path. 如果某个时候一切看起来正确,您可以通过将cuda-9.0更改为路径中的cuda来解决问题。 Strange but that worked for me. 奇怪,但是对我有用。

Solution 2- 解决方案2-

  1. Just create a symlink for files in your cuda/lib64 folder 只需为cuda / lib64文件夹中的文件创建符号链接
  2. Since you have cuda 9.0 installed your lib64 folder should have libcusolver.so.9.0 check this. 由于已经安装了cuda 9.0,因此您的lib64文件夹应具有libcusolver.so.9.0检查。
  3. If everything seems correct use ln -s /usr/local/cuda/lib64/libcusolver.so.9.0 /usr/local/cuda/lib64/libcusolver.so.8.0 如果一切看起来正确,请使用ln -s /usr/local/cuda/lib64/libcusolver.so.9.0 /usr/local/cuda/lib64/libcusolver.so.8.0
  4. You will have to do this manually for 7-8 files. 您将必须手动处理7-8个文件。

Try it, or please report the error. 试试看,或者报告错误。

Cheers 干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM