首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ModuleNotFoundError:没有名为“tensorflow.python.ops.numpy_ops”的模块

ModuleNotFoundError:没有名为“tensorflow.python.ops.numpy_ops”的模块
EN

Stack Overflow用户
提问于 2022-08-19 08:15:28
回答 1查看 95关注 0票数 3

我试图开始学习一些机器学习,并尝试导入Tensorflow,但我得到了一个ModuleNotFoundError:

代码语言:javascript
运行
复制
ModuleNotFoundError: No module named 'tensorflow.python.ops.numpy_ops'

当前的代码只是试图导入包:

代码语言:javascript
运行
复制
import os
import sys
import math
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras import LSTM

完整的回溯是:

代码语言:javascript
运行
复制
Traceback (most recent call last): 

 File "C:\Users\stacey\Documents\Atela\MachineLearning\NeuralNetworks\NeuralNetwork1.0.py", line 17, in <module>
    from tensorflow.keras import LSTM

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\__init__.py", line 47, in <module>
    from tensorflow.python import distribute

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\distribute\__init__.py", line 28, in <module>
    from tensorflow.python.distribute.experimental import collective_all_reduce_strategy

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\distribute\experimental\__init__.py", line 25, in <module>
    from tensorflow.python.distribute import tpu_strategy

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\distribute\tpu_strategy.py", line 28, in <module>
    from tensorflow.compiler.xla.experimental.xla_sharding import xla_sharding

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\compiler\xla\experimental\xla_sharding\xla_sharding.py", line 23, in <module>
    from tensorflow.compiler.tf2xla.python import xla as tf2xla

  File "C:\Users\stacey\AppData\Roaming\Python\Python36\site-packages\tensorflow\compiler\tf2xla\python\xla.py", line 43, in <module>
    from tensorflow.python.ops.numpy_ops import np_utils

ModuleNotFoundError: No module named 'tensorflow.python.ops.numpy_ops'

Python版本: 3.6

Tensorflow版本: 2.6.2

EN

Stack Overflow用户

发布于 2022-08-19 08:45:19

我不认为有tensorflow.keras.LSTM。也许你在找tensorflow.keras.layers.LSTM

更新:

这个问题通过升级解决了最新版本的tensorflow (2.9.1)和python (3.9)。可以找到这里版本兼容性表。

票数 3
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73413744

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档