在 jupyter-notebook 中导入 tensorflow 时发生错误

迪米特里

我已经在我的 windows 中安装了 tensorflow 版本 2.2.0。但是当我想导入它时它显示以下错误。我该如何解决这个问题?

    ---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     57 
---> 58   from tensorflow.python.pywrap_tensorflow_internal import *
     59 

G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>
     27             return _mod
---> 28     _pywrap_tensorflow_internal = swig_import_helper()
     29     del swig_import_helper

G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
     23             try:
---> 24                 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
     25             finally:

G:\anaconda\lib\imp.py in load_module(name, file, filename, details)
    241         else:
--> 242             return load_dynamic(name, filename, file)
    243     elif type_ == PKG_DIRECTORY:

G:\anaconda\lib\imp.py in load_dynamic(name, path, file)
    341             name=name, loader=loader, origin=path)
--> 342         return _load(spec)
    343 

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-15-5e7c1303e954> in <module>
----> 1 import tensorflow
      2 
      3 train_examples = tf.keras.utils.normalize(new_train, axis=1)
      4 
      5 test_examples = tf.keras.utils.normalize(new_test, axis=1)

G:\anaconda\lib\site-packages\tensorflow\__init__.py in <module>
     39 import sys as _sys
     40 
---> 41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
     43 

G:\anaconda\lib\site-packages\tensorflow\python\__init__.py in <module>
     48 import numpy as np
     49 
---> 50 from tensorflow.python import pywrap_tensorflow
     51 
     52 # Protocol buffers

G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
     67 for some common reasons and solutions.  Include the entire stack trace
     68 above this error message when asking for help.""" % traceback.format_exc()
---> 69   raise ImportError(msg)
     70 
     71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "G:\anaconda\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "G:\anaconda\lib\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 "G:\anaconda\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "G:\anaconda\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

无法加载本机 TensorFlow 运行时。

请参阅https://www.tensorflow.org/install/errors

出于一些常见的原因和解决方案。寻求帮助时,请在此错误消息上方包含整个堆栈跟踪。

佩德罗拉本

试试这个

  1. https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

  2. 下载 x64: vc_redist.x64.exe

  3. 安装它。

来源:https : //github.com/tensorflow/tensorflow/issues/35749#issuecomment-588425399

======

另一种可能的解决方案是降级到 tensorflow 2.0

pip install tensorflow==2.0

来源:https : //github.com/tensorflow/tensorflow/issues/35749#issuecomment-573313402

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在Jupyter Notebook中导入Pyperclip?

在Jupyter Notebook的另一个目录中导入py文件

无法在Jupyter Notebook中导入Scipy

无法在Jupyter Notebook中导入Tensorflow

在Jupyter Notebook中导入模块-路径

导入Tensorflow时Jupyter Notebook Kernel死亡

使用PyCharm导入模块时出现错误,而使用Jupyter Notebook时不会发生错误

无法在Jupyter Notebook的Python3环境中导入已安装的软件包

Jupyter Notebook Tensorflow MNIST导入错误:ImportError:无法导入名称批处理

我已使用pip和conda安装的模块无法在Sublime或Atom中导入,但可以使用Jupyter Notebook(有时甚至是Terminal)导入。

为什么即使安装了Jupyter Notebook(Python 3.6),也无法在我的Jupyter Notebook中导入utils?

尝试使用Docker jupyter / tensorflow-notebook登录Jupyter Notebook时的令牌无效

在conda安装后导入模块时,jupyter Notebook中的ModuleNotFoundError

无法在Jupyter Notebook中导入Tensorflow

Jupyter中导入熊猫的ModuleNotFound错误

Jupyter Notebook Tensorflow Pandas绘图错误

如何在Jupyter Notebook中导入python .py文件

仅使用coopr.pyomo在IPython Notebook中导入错误

Jupyter Notebook错误路径

在Jupyter Notebook中导入pyplot

在HDInsight上的Jupyter Notebook中导入自己的模块

python ZipImportError:仅当在Jupyter Notebook中导入时本地文件头错误

在Jupyter Notebook中导入TensorFlow GPU时出错

在从任何目录启动的 Jupyter Notebook 中导入 pyspark

没有 jupyter notebook 的 TensorFlow

导入pyqtgraph jupyter notebook时出错

如何在我的烧瓶 app.py 中导入 jupyter notebook 文件?

导入tensorflow时发生错误

spacy ImportError:无法在 Jupyter Notebook 中导入名称 Deque