gpt4 book ai didi

python - 如何使用 Python 3.6.5 修复 TensorFlow Keras API 中的 'ModuleNotFoundError: No module named ' tensorflow._api'

转载 作者:行者123 更新时间:2023-11-28 18:04:37 29 4
gpt4 key购买 nike

~\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py in <module>()
37 print('tf.estimator package not installed.')
38
---> 39 from tensorflow._api.v1 import app
40 from tensorflow._api.v1 import bitwise
41 from tensorflow._api.v1 import compat

ModuleNotFoundError: No module named 'tensorflow._api'

这是我每次尝试运行代码时不断收到的错误。

我尝试从 https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl 重新安装 tensorflow但每次我得到上述错误。

这些是我正在导入的库。

import tensorflow as tf
from tensorflow.keras.callbacks import TensorBoard
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
import pickle

我正在运行 Windows 10(64 位)

最佳答案

此错误可能是因为您的 PC 中可能未正确安装 Tensorflow。

这可能有多种原因。因此,可以有多种解决方案,如下所述。

如果您在尝试以下说明后问题仍然存在,请告诉我。谢谢。

你可以试试

pip uninstall tensorflow
pip uninstall tensorflow_estimator
pip install tensorflow tensorflow_estimator

只是为了确定。如果 tensorflow_estimator 卸载失败(未找到),请忽略该错误。

或者,您可以尝试在 python3 提示符下安装 Tensorflow。

或者,在您的 pip install 命令中,您可以尝试添加 --ignore_installed 标志

或者错误可能来自您 PC 中的多个 Python 发行版。您能否尝试从您的 PATH 文件中删除所有其他的,并检查问题是否已解决。

更多信息,请引用以下链接。

https://github.com/tensorflow/tensorflow/issues/29750

https://github.com/tensorflow/tensorflow/issues/6548

关于python - 如何使用 Python 3.6.5 修复 TensorFlow Keras API 中的 'ModuleNotFoundError: No module named ' tensorflow._api',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54200971/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com