【发布时间】:2021-12-21 13:56:47
【问题描述】:
我使用 Anaconda 创建了一个 tf2 tensorflow 环境。我可以通过命令提示符导入 tensorflow 没有问题。当我激活此环境并启动 Jupyter 笔记本时,我得到:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_20912/1332388178.py in <module>
1 # TensorFlow and tf.keras
----> 2 import tensorflow as tf
3
4 # Helper libraries
5 import numpy as np
ModuleNotFoundError: No module named 'tensorflow'
我创建了 run this 以将内核添加到 Jupyter(尽管我认为它只是使用当前活动的 conda 环境启动)。
python -m ipykernel install --user --name <Environment_Name>
但在 Jupyter 中明确使用 tf2 内核时仍然没有乐趣。虽然 jupyter 似乎无论如何都在启动活动的 tf2 环境。
[I 13:58:30.178 NotebookApp] Kernel shutdown: 603e39de-2b2e-4228-86ce-b135811ea301
[I 13:58:30.438 NotebookApp] Kernel started: 98f24818-ae84-4947-9c88-9b1814d9c768, name: tf2
[I 13:59:49.915 NotebookApp] Saving file at /tensorflow/Fashion MNIST.ipynb
【问题讨论】:
-
Jupyter 单元格中的“pip install tensorflow”
-
我为什么要这样做?不必与任何其他包一起做吗?
标签: tensorflow jupyter-notebook anaconda jupyter