tensorflow - 您好,我在 jupyter notebook 中导入 tensorflow 时出错
问题描述
帮我
ImportError Traceback (most recent call last) ~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in 63 try: ---> 64 from tensorflow.python._pywrap_tensorflow_internal import * 65 # 这个try catch逻辑是因为py_extension 没有等效的 bazel。
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The sp enter code here ecified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-2-f2ccb964fe70> in <module>
----> 1 from tensorflow.keras.preprocessing.text import Tokenizer
2 from tensorflow.keras.preprocessing.sequence import pad_sequences
3 from sklearn.preprocessing import StandardScaler
4 from sklearn.model_selection import train_test_split
~\anaconda3\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
~\anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
39
---> 40 from tensorflow.python.eager import context
41
42 # pylint: enable=wildcard-import
~\anaconda3\lib\site-packages\tensorflow\python\eager\context.py in <module>
33 from tensorflow.core.protobuf import config_pb2
34 from tensorflow.core.protobuf import rewriter_config_pb2
---> 35 from tensorflow.python import pywrap_tfe
36 from tensorflow.python import tf2
37 from tensorflow.python.client import pywrap_tf_session
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tfe.py in <module>
26
27 # pylint: disable=invalid-import-order,g-bad-import-order, wildcard-import, unused-import
---> 28 from tensorflow.python import pywrap_tensorflow
29 from tensorflow.python._pywrap_tfe import *
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
81 for some common reasons and solutions. Include the entire stack trace
82 above this error message when asking for help.""" % traceback.format_exc()
---> 83 raise ImportError(msg)
84
85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last):
File "C:\Users\Gaganu\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
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.
解决方案
最好的方法是如果你使用 anaconda 环境,
conda create -n myenv python=3.7
conda activate myenv
然后
pip install tensorflow
或者
pip install tensorflow-gpu
看看这是否有效,或者如果您有 bazel 错误,请告诉我,我也会将安装指南放在这里。
推荐阅读
- boost - 为什么 FindBoost.cmake 总是读取旧的 BOOST_ROOT,它不再存在,不再存在于任何存储环境变量的文件中
- kotlin - 错误:“声明多个名为...的 JSON 字段”解析具有接口中定义的 getter/setter 值的类时
- macros - 如何使 Kentico 表单中的字段可见性基于两个条件工作
- python - 如何用棍子击球使球移动?
- laravel - laravel 更新编辑数据库记录 - 提交表单时出错
- java - 将 Long/ULong 转换为带有填充零的无符号十六进制字符串
- power-automate - 将电子邮件附件保存到 Google 驱动器附件名称会自动删除该字母
- java - 包 sun.awt 不存在
- python - 使用 python 暴力破解密码的问题
- vb.net - 为什么我的代码在 ide 中显示警告消息“通过实例访问共享成员;将不评估限定表达式”