具有Tensorflow后端的Keras - 导入错误

时间:2018-06-07 10:16:06

标签: python-3.x tensorflow cuda keras gpu

我刚刚用python3安装了tensorflow-gpu。当我尝试它时,我得到了下面的错误。

代码:

from keras import backend as K

错误:

/logiciels/Python-3.5.2/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.  from ._conv import register_converters as _register_converters Using TensorFlow backend. Traceback (most recent call last):    File "/projets/iris/PROJETS/WEIR/python_env/inherited/python3.5/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import *   File "/projets/iris/PROJETS/WEIR/python_env/inherited/python3.5/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()   File "/projets/iris/PROJETS/WEIR/python_env/inherited/python3.5/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)   File "/projets/iris/PROJETS/WEIR/python_env/inherited/python3.5/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)   File "/projets/iris/PROJETS/WEIR/python_env/inherited/python3.5/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)  ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

1 个答案:

答案 0 :(得分:2)

  

ImportError:libcublas.so.9.0:无法打开共享对象文件:没有这样的文件或目录

您的Tensorflow版本似乎已针对CUDA 9.0进行了编译。确保已正确安装和引用此版本的CUDA,或自行编译Tensorflow以适合您的环境(install doc)。