tensorflow - 我安装了 tensforflow 并使用了该命令,但它显示以下错误
问题描述
我写的代码是这样的:
from tensorflow.keras.models import Sequential
这是给出的错误......如果有人能说出出路那就太好了
ImportError Traceback (most recent call last)
~\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
63 try:
---> 64 from tensorflow.python._pywrap_tensorflow_internal import *
65 # This try catch logic is because there is no bazel equivalent for py_extension.
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-18-f05745da3b73> in <module>
----> 1 from tensorflow.keras.models import Sequential
~\Python\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
~\Python\lib\site-packages\tensorflow\python\__init__.py in <module>
37 # go/tf-wildcard-import
38 # pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top
---> 39 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
40
41 from tensorflow.python.eager import context
~\Python\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\saksh\Python\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.
解决方案
错误消息说某些 DLL 文件加载失败,这是因为 Tensorflow 包没有正确安装。原因可能是您没有安装MSVC 2019 redistributable
或您的CPU does not support AVX2 instructions
.
安装软件要求并确保您的系统满足Tensorflow 安装文档中提到的硬件要求。
推荐阅读
- github - 如何使 Jupyter Notebook 中的彩色文本在 Github 中工作?
- kubernetes - 不使用标签的命名空间子集的 Gatekeeper/OPA 约束
- c# - 没有通知错误,但代码未按指示执行
- javascript - 如何在js中更改图片上传的exif数据
- python - 从集合中随机选择一个/多个函数并应用组合
- r - 提取r中整个数据帧范围内的值
- reactjs - 使用 react-bootstrap 设计一个漂亮的用户帐户仪表板
- javascript - 12 小时 Javascript 时钟显示 24 时间,上午/下午错误
- javascript - 我编写了一个 nodejs 应用程序来操作 Google 表格。如何将其转换为附加组件?
- asp.net-core - blazor webassembly System.Net.Http.HttpRequestException:响应状态码不表示成功:400(错误请求)