安装tensorflow-gpu,相关报错的解决办法

时间:2024-05-23 14:14:57

1、报错内容
C:\Users\Administrator\anaconda3\envs\py3.6\python.exe D:/F1/exercise/wangyi/ai_tang/shen_du/ten2_test/test1.py
Traceback (most recent call last):
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “D:/F1/exercise/wangyi/ai_tang/shen_du/ten2_test/test1.py”, line 2, in
import tensorflow
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow_init_.py”, line 41, in
from tensorflow.python.tools import module_util as module_util
File "C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python_init
.py", line 40, in
from tensorflow.python.eager import context
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python\eager\context.py”, line 35, in
from tensorflow.python import pywrap_tfe
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python\pywrap_tfe.py”, line 28, in
from tensorflow.python import pywrap_tensorflow
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 83, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\Users\Administrator\anaconda3\envs\py3.6\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 64, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

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.

2、解决办法
安装2.1.0版本程序包需要msvcp140_1.dll文件,点击上图中的Microsoft VC++ downloads下载安装包并下载,即可成功导入Tensorflow。
安装tensorflow-gpu,相关报错的解决办法
下载地址:https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads

3 继续报错
安装完成后碰到的问题:运行tensorflow时,出现ImportError: DLL load failed:找不到指定的模块:
cublas64_100.dll
cusolver64_100.dll
cudart_64_100.dll
解决办法:

先进入路径‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin’,复制下面三个文件到桌面,改名字为上述找不到指定模块的名称,改完后,再粘贴回去,tensorflow就能成功运行了。
cublas64_10.dll
cusolver64_10.dll
cudart64_101.dll