【问题标题】:ModuleNotFoundError: No module named 'tensorflow_hub'ModuleNotFoundError:没有名为“tensorflow_hub”的模块
【发布时间】:2021-01-01 04:15:37
【问题描述】:

我按照 TensorFlow 网站上的说明安装 tensorflow_hub 并将其安装在 conda 环境中。

$ pip install "tensorflow>=2.0.0"
$ pip install --upgrade tensorflow-hub

我在 anaconda 提示符下运行了上述内容

但我仍然收到 ModuleNotFoundError 的“tensorflow_hub”。

感谢您提供任何帮助。提前致谢

【问题讨论】:

  • 可能是您正在使用多个环境
  • 使用python -m pip install --upgrade tensorflow-hub,并将python替换为您想要使用的任何python解释器。
  • 嗨 Abhiram kadali,正如 Adam 建议的那样,您能否确认您是否在安装它的 virtual environment 中使用 importing tensorflow hub。谢谢!
  • 我的意思是说,请确保您在Virtual Environment、py3_TF2.0 中是importing tensorflow_hub。如果仍然导致错误,请分享您的代码。

标签: python tensorflow tensorflow2.0 tensorflow-hub modulenotfounderror


【解决方案1】:

第一件事 检查您是否在该环境中安装了 tensorflow_hub

conda list

如果在那里找不到,可能是你一直在安装到其他环境,没关系,在这里重新安装。

pip install tensorflow_hub

您可能已经这样做了,因此很可能您在 jupyter notebook 中使用了另一个内核,因此请转到该内核的环境并在那里安装您的软件包。或者首选方法,将您当前的环境 yourenvironment 安装为新内核并在您的 jupyter notebook 中使用该内核

  python -m ipykernel install --user --name=yourenvironment

现在开始你的 jupyter notebook 并享受你的包

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-28
    • 2022-01-07
    • 2017-12-14
    • 2020-12-10
    • 2021-09-02
    • 2020-10-10
    • 2022-01-06
    相关资源
    最近更新 更多