jupyter notebook上完美运行tensorflow、keras

jupyter中使用TensorFlow 在激活TensorFlow之后安装ipython和jupyter
Tensorflow的安装见之前发的 win10+python3.6+tensorflow-cpu+keras+Pycharm环境下的tensorflow配置方法

win10+python3.6+tensorflow-cpu+keras+Pycharm环境下的tensorflow配置方法

(tensorflow) C:\Users\Administrator>python
Python 3.6.11  [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import keras
Using TensorFlow backend.
>>>quit()

(tensorflow) C:\Users\Administrator>

安装测试完keras之后,先用quit()退出python代码编辑,在tensorflow环境下,输入如下命令:

conda install ipython

(tensorflow) C:\Users\Administrator>conda install ipython

conda install jupyter

(tensorflow) C:\Users\Administrator>conda install jupyter

ipython kernelspec install-self --user
这里需要注意user前面是两个–

(tensorflow) C:\Users\Administrator>ipython kernelspec install-self --user
[TerminalIPythonApp] WARNING | Subcommand `ipython kernelspec` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter kernelspec` in the future
[InstallNativeKernelSpec] WARNING | `jupyter kernelspec install-self` is DEPRECATED as of 4.0. You probably want `ipython kernel install` to install the IPython kernelspec.
[InstallNativeKernelSpec] Installed kernelspec python3 in C:\Users\Administrator\AppData\Roaming\jupyter\kernels\python3

打开Jupyter notebook,运行

import tensorflow as tf
import keras

在这里插入图片描述

没报错,代表成功!!!

参考
使用anaconda安装tensorflow,并在Jupyter Notebook使用

猜你喜欢

转载自blog.csdn.net/weixin_45656790/article/details/108931267