Tensorflow共享库错误;ImportError:libcuda.so.1:无法打开共享对象文件:没有这样的文件或



我认为我的cudatoolkit版本10.0.130有问题。我不理解这个错误消息。我想在x射线图像上使用Gradcam(热图生成器(。这是深度学习的AI for Medicine的相同代码。AI,我想在我的机器上运行它,我正在尝试为这个模型创建一个REST API。

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from keras.preprocessing.image import ImageDataGenerator
from keras.applications.densenet import DenseNet121
from keras.layers import Dense, GlobalAveragePooling2D
from keras.models import Model
from keras import backend as K
import keras.backend.tensorflow_backend as K
from keras.models import load_model
K.set_session
import util

文件util.py是在同一目录中定义的。

Using Theano backend.
Traceback (most recent call last):
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/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 "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 11, in <module>
import keras.backend.tensorflow_backend as K
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/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 "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/media/macarov/Volume_H/Anacond3-Linux/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: libcuda.so.1: cannot open shared object file: No such file or directory

Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

问题是我的虚拟环境中的python 3.7。我降级到python 3.6.5,一切似乎都很好。

最新更新