如何解决 JupyterNotebook for tensorflow 中找不到模块的错误?

How to resolve module not found error in JupyterNotebook for tensorflow?

我使用以下命令集创建了 tensorflow 环境:

conda create --name py3-TF2.0 python = 3

conda activate py3-TF2.0
conda install tensorflow
pip install -upgrade tensorflow
pip install ipykernel

尝试这些步骤以使用 Conda 安装 Tensorflow

#create virtual environmenttf2.0 using conda 
conda create --name tf2.0 python=3
#Activate the env
conda activate tf2.0
#Install Tensorflow
tf2.0$pip install tensorflow
tf2.0$python
#Verify the Tensorflow installation before launching any of the IDE
>>import tensorflow as tf
>>tf.__version__


#Launch the jupyter notebook
tf2.0$conda install jupyter
tf2.0$jupyter notebook

你可以做的是 运行 jupyter notebook 并尝试从那里安装 tensorflow。

在 jupyter notebook 单元格中输入:

!pip install tensorflow==2.0.0

(不要错过前面的 ! 符号)

测试:

import tensorflow as tf
tf.__version__