在PyCharm环境下使用Jupyter Notebook

1、安装Jupyter Notebook

打开Pytharm中的setting,找到Project Interpreter里面通过+号添加,如下图:

![这里写图片描述](https://img-blog.csdn.net/20180418141503505?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

然后搜索Jupyter,点击install安装:

![这里写图片描述](https://img-blog.csdn.net/20180418141829721?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)


2、在PyCharm中新建Jupyter Notebook文件

步骤:File->New...->Jupyter Notebook->输入文件名

建好之后效果如下图所示,就是熟悉的Jupyter Notebook界面:

![这里写图片描述](https://img-blog.csdn.net/20180418135714544?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)


3、复制URL

在左下角Terminal中输入:Jupyter-notebook

可以看到一个链接,如下图:

![这里写图片描述](https://img-blog.csdn.net/20180418143447855?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

4、运行

输入测试代码,点击绿色小三角运行代码。

![这里写图片描述](https://img-blog.csdn.net/20180418142156143?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

这里会跳出一个窗口提示你需要输入URL,把刚刚第3步复制的内容黏贴上去即可:

![这里写图片描述](https://img-blog.csdn.net/20180418143205418?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

5、结果显示

![这里写图片描述](https://img-blog.csdn.net/20180418144155551?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)



另:在Python Console里直接编程

打开PyCharm,在界面的左下方点击进入Python Console,看到熟悉的Jupyter Notebook界面:

![这里写图片描述](https://img-blog.csdn.net/20180418135444707?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)


运行结果如下:

![这里写图片描述](https://img-blog.csdn.net/20180418144642664?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2ltNjUyMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)

输入代码,点击左边的绿色小三角运行,或者按Enter键。

PS:由于按Enter键是运行代码,所以要换行的话按Shift + Enter

参考:https://blog.csdn.net/xiemanr/article/details/71837385
参考:https://blog.csdn.net/da_yuan8421/article/details/79239764

你可能感兴趣的:(工具,Python)