【问题标题】:How to resolve module not found error in JupyterNotebook for tensorflow?如何解决 JupyterNotebook for tensorflow 中未找到模块错误?
【发布时间】:2021-02-21 10:57:50
【问题描述】:

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

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

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

【问题讨论】:

  • 我发现目前 tensorflow 不支持 Python 3.9,由于我使用的是 Python 3.9,所以我遇到了上述问题。因此,为此我创建了一个新的虚拟环境,并使用了与上述相同的命令并稍加调整 python=3.8 并且它起作用了。

标签: python tensorflow jupyter-notebook anaconda tensorflow2.0


【解决方案1】:

尝试这些步骤以使用 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

【讨论】:

    【解决方案2】:

    您可以运行 jupyter notebook 并尝试从那里安装 tensorflow。

    在 jupyter 笔记本单元格中输入:

    !pip install tensorflow==2.0.0
    

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

    测试:

    import tensorflow as tf
    tf.__version__
    

    【讨论】:

      猜你喜欢
      • 2020-11-01
      • 2020-11-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-24
      • 2021-04-08
      • 2021-08-31
      • 2022-07-22
      相关资源
      最近更新 更多