ModuleNotFoundError:没有名为“tensorflow_hub”的模块

Abh*_*ali 5 python tensorflow tensorflow-hub tensorflow2.0 modulenotfounderror

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

$ pip install "tensorflow>=2.0.0"
$ pip install --upgrade tensorflow-hub
Run Code Online (Sandbox Code Playgroud)

我在 anaconda prompt 中运行了上面的命令

在此处输入图片说明

但我仍然ModuleNotFoundError对“tensorflow_hub”感到满意。

任何帮助在这里表示赞赏。提前致谢

mrk*_*mrk 20

首先 检查您是否在该环境中安装了tensorflow_hub

conda list
Run Code Online (Sandbox Code Playgroud)

如果你在那里找不到它,也许你已经把它安装到另一个环境了,没关系,在这里重新安装一下即可。

pip install tensorflow_hub
Run Code Online (Sandbox Code Playgroud)

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

  python -m ipykernel install --user --name=yourenvironment
Run Code Online (Sandbox Code Playgroud)

现在启动您的 jupyter 笔记本并享受您的包