Import error tensorflow-gpu in ubuntu18.04
我在导入tensorflow时遇到一些错误。
我的电脑规格:
操作系统:ubuntu 18.04
Nvidia RTX 2080 Ti * 2
Nvidia司机-415
CUDA:10.0
cuDNN:7.3.0
tensorflow:1.11.0
1 | import tensorflow |
错误:
Traceback (most recent call last): File
"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py",
line 58, in
from tensorflow.python.pywrap_tensorflow_internal import * File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28, in
_pywrap_tensorflow_internal = swig_import_helper() File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File"/usr/lib/python3.6/imp.py", line 243,
in load_module
return load_dynamic(name, filename, file) File"/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directoryDuring handling of the above exception, another exception occurred:
Traceback (most recent call last): File"", line 1, in
File
"/usr/local/lib/python3.6/dist-packages/tensorflow/init.py", line
22, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File
"/usr/local/lib/python3.6/dist-packages/tensorflow/python/init.py",
line 49, in
from tensorflow.python import pywrap_tensorflow File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py",
line 74, in
raise ImportError(msg) ImportError: Traceback (most recent call last): File
"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py",
line 58, in
from tensorflow.python.pywrap_tensorflow_internal import * File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 28, in
_pywrap_tensorflow_internal = swig_import_helper() File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py",
line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File"/usr/lib/python3.6/imp.py", line 243,
in load_module
return load_dynamic(name, filename, file) File"/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directoryFailed to load the native TensorFlow runtime.
See
https://www.tensorflow.org/install/install_sources#common_installation_problemsfor some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
我已经尝试使用ubuntu 16.04,但GPU不支持。
也不支持安装CUDA9.0和CUDA9.2。
我怎么能用tensorflow-gpu?
我已经在?/ .bashrc中使用了app路径
1 2 3 4 5 | export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}} export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export CUDA_HOME=/usr/local/cuda-10.0 export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64 export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64$LD_LIBRARY_PATH |
您需要将您的Cuda版本降级到9.0(但如果我记得,使用2080Ti是不可能的),或者从源代码构建张量流。 有关如何在tensorflow网站上执行此操作的大量文档
您也可以尝试安装包