[英]Issue on staring tensorflow on Jupyter notebook
我打开 Anaconda Navigator,点击环境,点击更新索引,从下拉列表中选择卸载,搜索 Tensorflow,选择 Keras 和选择 Tensorflow,点击应用,然后我继续直到过程成功完成,然后我退出了。 之后,我打开 Jupyter Notebook 并输入代码“import tensorflow as tf”但是,我遇到了以下错误:
ImportError Traceback (most recent call last)
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
61 try:
---> 62 from tensorflow.python._pywrap_tensorflow_internal import *
63 # This try catch logic is because there is no bazel equivalent for py_extension.
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_8976\3793406994.py in <module>
----> 1 import tensorflow as tf
~\anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
35 import typing as _typing
36
---> 37 from tensorflow.python.tools import module_util as _module_util
38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
39
~\anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
34 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
35
---> 36 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
37 from tensorflow.python.eager import context
38
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
75 sys.setdlopenflags(_default_dlopen_flags)
76 except ImportError:
---> 77 raise ImportError(
78 f'{traceback.format_exc()}'
79 f'\n\nFailed to load the native TensorFlow runtime.\n'
ImportError: Traceback (most recent call last):
File "C:\Users\Amir\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 62, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.
我在 Windows 10 Pro 上安装了最新的 anaconda3 发行版。 这也会安装 Python 3.9。
然后我按照以下步骤操作:
安装新版本的 Anaconda3 Navigator(弹出窗口要求它 - 如果是 2.3.2 的新版本,则为 2.3.1)
单击“环境”并单击“创建”(最好为每个目的创建新环境)
创建了一个新的环境。 称为“tensorflow_helper”并选择 python 3.9.15 并单击创建
在这个阶段我有一个干净的环境,可以更好地分析问题的根源
我从顶部组合(显示已安装)中选择“未安装”并选择“tensorflow”
从那里单击“新建”(右上角)并选择新建和“Pyton 3(ipykernel)”
在这个阶段,它应该在你的默认浏览器上打开一个新窗口,使用你的“tensorflow_helper”环境。 只需键入以下内容来测试安装(不要忘记在运行时单击):
注意:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.