(转)Pycharm无法启动本地jupyter notebook(403 post /api/kernels : '_xsrf' arument missing from post )
前提,在本地已经有了一个可以在cmd中启动运行的jupyter notebook,且你想用这个本地的jupyter notebook也能在pycharm上运行。(如果你有一台开着远程jupyter notebook的服务器,只要填对token就行了,后面都不需要看)(如果发现启动jupyter notebook 时没有在终端中显示token,可以看一下在.jupyter文件夹下(和jupyter_notebook_config.py同一个文件夹)是否有jupyter_notebook_config.json,若多余的话可以直接删掉)
当已经在本地cmd中启动了一个jupyter notebook 时,如果在pycharm中运行ipynb文件,需要连接本地的这个jupyter notebook ,就会发生 403 post /api/kernels <127.0.0.1>: '_xsrf' arument missing from post
这个错其实和xsrf无关,而是pycharm同时启动了一个新的jupyter notebook,而本地不支持同时创建两个jupyter notebook,所以即便你把token填对了,都无法再pycharm成功运行。
正确的启动方式是,将本地cmd的jupyter notebook关闭,
配置pycharm的Run/Debug Configurations,
'Run'->Edit Configurations,点击左上角+,选择jupyter notebook,全部默认,点击OK,
右上角选择刚配置好的jupyter notebook环境,点击Run,
此时就会在pycharm中启动jupyter notebook了,最后点击该文件的run cells,完成程序的运行。
可以把运行终端输出的url复制到浏览器中,在浏览器中也能完成程序的编辑。
转自:
(1条消息)Pycharm无法启动本地jupyter notebook(403 post /api/kernels 《127.0.0.1》: 'xsrf’ arument missing from post ) - jasonwang_的博客 - ****博客
https://blog.****.net/jasonwang/article/details/86033029