Windows环境下安装TensorFlow并在Jupyter notebook上使用

在成功安装tensorflow之后,在Anaconda Prompt中activate tensorflow之后,输入python,再输入import tensorflow as tf可以正确运行,但是在jupyter notebook上import的时候一直报错说找不到tensorflow模块,网上找了找解决办法,发现是我们只有在tensorflow环境下才可以打开notebook才可以正确import tensorflow as tf,因此,解决办法如下:

我们在Anaconda Prompt中activate tensorflow之后,再输入这个:

(tensorflow)D:\>ipython kernelspec install-self --user
  • 1

看到类似这个结果

Installed kernelspec python3 in C:\Users\XXX\Jupyter\kernels\python3
  • 1

然后再去 jupyter notebook 新建一个文件,试试 import tensorflow as tf,这时应该就可以用啦。

参考:https://blog.csdn.net/index20001/article/details/73555182

https://zhuanlan.zhihu.com/p/37050300

你可能感兴趣的:(机器学习)