Pycharm安装并配置jupyter notebook的实现

一: 安装命令jupyter: pip install jupyter

如果缺少依赖,缺啥装啥

二: 运行 jupyter notebook

首先,查看一下自己是否已经安装成功,在终端输入:

jupyter notebook

如果运行成功,结果如下:

[I 09:03:15.177 NotebookApp] JupyterLab beta preview extension loaded from /home/winddy/anaconda3/lib/python3.6/site-packages/jupyterlab
[I 09:03:15.177 NotebookApp] JupyterLab application directory is /home/winddy/anaconda3/share/jupyter/lab
[I 09:03:15.182 NotebookApp] Serving notebooks from local directory: /home/winddy
[I 09:03:15.182 NotebookApp] 0 active kernels
[I 09:03:15.182 NotebookApp] The Jupyter Notebook is running at:
[I 09:03:15.182 NotebookApp] http://localhost:8888/?token=c19f036f3beb2bce5112ca9c2f4565e738175a9853302e44
[I 09:03:15.182 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:03:15.183 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=c19f036f3beb2bce5112ca9c2f4565e738175a9853302e44&token=c19f036f3beb2bce5112ca9c2f4565e738175a9853302e44
[I 09:03:15.693 NotebookApp] Accepting one-time-token-authenticated connection from ::1
Created new window in existing browser session.
[W 09:03:16.282 NotebookApp] Error stat-ing /home/winddy/.gvfs: [Errno 13] Permission denied: '/home/winddy/.gvfs'

从上面可以知道,Jupyter notebook 生成的服务器地址为:http://localhost:8888/?token=c19f036f3beb2bce5112ca9c2f4565e738175a9853302e44 其中端口号为8888,注意,如果你打开多个Jupyter notebook , 那么每一个服务的端口号是不一样的

三: 上面都执行成功后,在pycharm 配置 jupyter notebook

这里巨坑,pycharm 的官网都JB坑

先给无差错的配置结果

在pycharm 新建一个后缀名为:.ipynb 的文件,如果你的pycharm没有解析改后缀名的插件,按照提示默认装好插件就可以

在第一个cell中输入: %matplotlib inline

注意,你可以在这个会话框中填入服务器地址,但是,我们这里只想在本地编辑,所以直接点取消, 然后出现

他会说不能连接到Jupyter notebook, 我们不管这个提示,因为我们只想在本地编辑,所以直接点击 run Jupyter notebook
!!!!!!到这里,如果没出现错误的话,pycharm会直接帮你启动服务并运行你指定的代码

(如果,你看到这个界面,那说明就OJBK了)

填写测试代码,逐个运行

NotebookApp] '_xsrf' argument missing from POST、

到此这篇关于Pycharm安装并配置jupyter notebook的实现的文章就介绍到这了,更多相关Pycharm安装配置jupyter notebook内容请搜索来客网以前的文章或继续浏览下面的相关文章希望大家以后多多支持来客网!