【问题标题】:Spyder can't load tensorflow in conda environment although python canSpyder 无法在 conda 环境中加载 tensorflow,尽管 python 可以
【发布时间】:2023-12-01 06:22:01
【问题描述】:

我在依赖项中创建了一个 conda 环境,包括 Spydertensorflow,所有安装都没有错误。

当我激活环境并启动 python 时,我可以毫无问题地导入 tensorflow 并运行代码。

但是在从环境中启动 spyder(Spyder 显示在属于该 conda 环境的 GUI 底部)并加载 tensorflow 时,会引发错误:

ModuleNotFoundError: No module named 'tensorflow_core.estimator' 

从那时起,控制台就会卡住重复相同的错误。

为什么 spyder 在导入同一环境中的 python 可以导入的模块时会出现问题?我该如何解决这个问题?

我尝试在 conda 环境中重新安装 spyder,但同样的问题仍然存在。

【问题讨论】:

    标签: tensorflow anaconda spyder


    【解决方案1】:

    尝试卸载 tensorflow-estimator pip uninstall tensorflow-estimator 并卸载 Tensorflow。

    #After fresh installing tensorflow
    pip install tensorflow
    #Install tensorflow_estimator
    pip install -U tensorflow_estimator
    

    也可以尝试this 解决方法。

    【讨论】:

      最近更新 更多