导入tensorflow时出错。
我的环境
ubuntu 18.04桌面
nvidia图形驱动程序470.42.01
cuda 11.4
python 3.6.14(Python)
tensorflow gpu 1.12.0
cuda环境变量设置已完成(11.4),链接符号链接位于/usr/local/cuda处,来自/usr/local/cuda-11.4
(使用旧版本的原因是该项目的sdk是在过去编写的。)
在运行python后导入tensorflow时,会发生以下错误:
>>> import tensorflow
Traceback (most recent call last):
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/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 "/home/(username)/anaconda3/envs/mdk/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/(username)/anaconda3/envs/mdk/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 directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/(username)/anaconda3/envs/mdk/lib/python3.6/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 "/home/(username)/anaconda3/envs/mdk/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/home/(username)/anaconda3/envs/mdk/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 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.
我安装了cuda 9.0来修复此错误。然而,7.0版也出现了同样的错误。
我需要安装我需要的所有cuda版本吗?或者有没有其他办法解决这个问题?
暂无答案!
目前还没有任何答案,快来回答吧!