Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 导入tensorflow时,出现错误';ImportError:DLL加载失败:找不到指定的模块。';_Python_Tensorflow_Import_Compiler Errors - Fatal编程技术网

Python 导入tensorflow时,出现错误';ImportError:DLL加载失败:找不到指定的模块。';

Python 导入tensorflow时,出现错误';ImportError:DLL加载失败:找不到指定的模块。';,python,tensorflow,import,compiler-errors,Python,Tensorflow,Import,Compiler Errors,我已经看到并实施了一些解决我的问题的潜在方案,但似乎都不起作用。 我可以解决导入tensorflow时的错误吗 版本 -->python 3.7.4 -->tensorflow 2.3.0 runfile('C:/Users/pshad/.spyder-py3/temp.py', wdir='C:/Users/pshad/.spyder-py3') Traceback (most recent call last): File "<ipython-input-27-bc8f

我已经看到并实施了一些解决我的问题的潜在方案,但似乎都不起作用。 我可以解决导入tensorflow时的错误吗

版本 -->python 3.7.4 -->tensorflow 2.3.0

runfile('C:/Users/pshad/.spyder-py3/temp.py', wdir='C:/Users/pshad/.spyder-py3') Traceback (most recent call last):

  File "<ipython-input-27-bc8fb4f78acd>", line 1, in <module>
    runfile('C:/Users/pshad/.spyder-py3/temp.py', wdir='C:/Users/pshad/.spyder-py3')

  File "C:\Users\pshad\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
    execfile(filename, namespace)

  File "C:\Users\pshad\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/pshad/.spyder-py3/temp.py", line 9, in <module>
    import tensorflow as tf

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow

  File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)

ImportError: Traceback (most recent call last):   File "C:\Users\pshad\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.
runfile('C:/Users/pshad/.spyder-py3/temp.py',wdir='C:/Users/pshad/.spyder-py3')回溯(最后一次调用):
文件“”,第1行,在
运行文件('C:/Users/pshad/.spyder-py3/temp.py',wdir='C:/Users/pshad/.spyder-py3')
文件“C:\Users\pshad\Anaconda3\lib\site packages\spyder\u kernels\customize\spyderrcustomize.py”,第827行,在runfile中
execfile(文件名、命名空间)
文件“C:\Users\pshad\Anaconda3\lib\site packages\spyder\u kernels\customize\spyderrcustomize.py”,第110行,在execfile中
exec(编译(f.read(),文件名,'exec'),命名空间)
文件“C:/Users/pshad/.spyder-py3/temp.py”,第9行,在
导入tensorflow作为tf
文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\\uuuu init\uuuu.py”,第41行,在
从tensorflow.python.tools将模块_util作为_模块_util导入
文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\python\\uuuu init\uuuu.py”,第40行,在
从tensorflow.python.eager导入上下文
文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\python\eager\context.py”,第35行,在
从tensorflow.python导入pywrap\u tfe
文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\python\pywrap\u tfe.py”,第28行,在
从tensorflow.python导入pywrap\u tensorflow
文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\python\pywrap\u tensorflow.py”,第83行,在
提高效率(msg)
ImportError:Traceback(最近一次调用last):文件“C:\Users\pshad\Anaconda3\lib\site packages\tensorflow\python\pywrap\u tensorflow.py”,第64行,在
从tensorflow.python.\u pywrap\u tensorflow\u内部导入*导入错误:DLL加载失败:找不到指定的模块。
未能加载本机TensorFlow运行时。

我认为软件包安装不正确。尝试重新安装。(如果使用“pip”进行安装,请不要忘记更新)

Anaconda为Tensorflow提供了一个安装,它可以处理所有问题,包括所有GPU和CUDA依赖项:

conda install -c anaconda tensorflow-gpu

它适用于Tensorflow 2.1和Python 3.7。当组件单独安装或通过Anaconda以外的其他渠道安装时,DLL故障很常见。

我已经尝试过多次,升级、降级、卸载和重新安装。似乎什么都不管用,我建议你尝试在中编程。这速度更快,不需要安装任何库牙库,但谷歌服务在中国是不允许的。@MohammadAdrasharifzadeh这是否意味着我也可以使用谷歌Colab运行计算复杂且耗时的代码?是的!但它通常用于运行人工智能程序(特别是张量流),你找到答案了吗?