Pycharm安装并配置jupyter notebook

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坑

先给无差错的配置结果

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

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

     
    Selection_001.png
  3. 点击运行按钮,这时,用户会因为环境不同会报各种错,这个放在后面讲

     
    Selection_002.png
  4. 点击后pycharm会弹出一个会话框

     
    Selection_003.png

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

 
Selection_004.png

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

 
Selection_005.png

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

  1. 填写测试代码,逐个运行

     
    Selection_006.png

四: 常见错误

  • 如下,报“ Running as root is not recommended. Use --allow-root to bypass.”, 这个比较好解决,这个错误的原因是你是以root身份运行pycharm。 所以我们只要退出pycharm,然后在pycharm所在目录下 运行指令 sh pycharm.sh, 如果你是用命令: sudo sh pycharm.sh 运行pycharm,那么你就会以管理员的身份运行pycharm (注意,重启终端,如果你的终端刚被执行了sudo, 那么此时执行 sh pycharm.sh 也是管理员身份)
[I 09:02:18.636 NotebookApp] JupyterLab beta preview extension loaded from /home/winddy/anaconda3/lib/python3.6/site-packages/jupyterlab
[I 09:02:18.636 NotebookApp] JupyterLab application directory is /home/winddy/anaconda3/share/jupyter/lab
[C 09:02:18.641 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.
  • 报权限不够, 直接按提示路径找到 jupyter的文件夹,修改权限问任何人可读可写
sudo chmod 777 jupyter/
Permission denied: '/home/winddy/.local/share/jupyter/kernels'

  • 报 _xsrf 参数丢失, 官方bug, 请下载最新版本
    NotebookApp] '_xsrf' argument missing from POST

作者:winddy_akoky
链接:https://www.jianshu.com/p/3d2415de9dd8
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

Pycharm安装并配置jupyter notebook的更多相关文章

  1. 安装、配置Jupyter Notebook快速入门教程

    What? Why? How? ---安装 ---启动 ---关闭 ---保存 Markdown语法 Magic关键词 转换notebook--toHTML 创建幻灯片 运行代码 What? 文字化编 ...

  2. 安装并使用Jupyter Notebook

      Jupyter Notebook是一个交互式笔记本,支持运行 40 多种编程语言.笔者在写博客文章时,常常需要贴代码,一贴就是一大堆代码,这样不便于读者阅读,而使用Jupyter Notebook ...

  3. Ubuntu 16.04远程配置Jupyter Notebook

    安装和配置Jupyter Notebook 安装jupyter notebook conda conda install -c conda-forge notebook pip pip install ...

  4. 安装python的jupyter notebook工具

    jupyter notebook是一个通过网页运行python的工具 支持分段的python运行,并能直观的查看结果 支持多python环境运行,需要加装(conda) 安装步骤 1.安装python ...

  5. Ubuntu 16.04 LTS 配置 Jupyter notebook 为服务器

    原材料: Ubuntu 16.04 LTS 64bit 已经配置好 IPython 和 Jupyter (安装步骤可以参照:http://www.cnblogs.com/McKean/p/619497 ...

  6. 在linux下配置jupyter notebook,本地浏览器访问

    1.安装jupyter notebook pip install jupyter 2.生成配置文件 jupyter notebook --generate-config 3.设置登陆密码并生成秘钥 s ...

  7. 配置Jupyter Notebook

    配置Jupyter Notebook 1 修改Jupyter Notebook的工作目录 Jupyter默认打开的是用户目录,使用如下步骤自行修改: CMD生成Jupyter配置文件: (python ...

  8. 怎么配置Jupyter Notebook默认启动目录?

    前言 系统环境:win10 x64:跟环境也没啥关系,在LInux下也一样... 前段时间重换了系统后,发现Jupyter Notebook的默认启动目录不太对呀,所以,就翻到了以前的笔记,还是记在这 ...

  9. ubuntu安装spyder和jupyter notebook

    ubuntu安装spyder和jupyter notebook 安装spyder 安装spyder sudo apt install spyder sudo apt install spyder3 安 ...

随机推荐

  1. sql sever insert into混合嵌套插入

    如果你想插入的字段取值方式不同,既有自己设定的值,又想插入某个表中的某个字段数据,下面就举例说明 insert into Meters(metertypeid, meternumber, consta ...

  2. 【Spring源码分析系列】ApplicationContext 相关接口架构分析

    [原创文章,转载请注明出处][本文地址]http://www.cnblogs.com/zffenger/p/5813470.html 在使用Spring的时候,我们经常需要先得到一个Applicati ...

  3. 2020考研-必须了解的干货"极限微分和你说的悄悄话"

    极限微分和你说的悄悄话 2019-03-02 RunWsh 美食供应商有考研学子 想必接触过数学或物理的都对牛顿和莱布尼兹不陌生.如果你是考研大军中的一员,估计天天会与他们眉来眼去的吧! 牛顿莱布:别 ...

  4. Python编程Day1——计算机组成与操作系统

    一..计算机基础 二.编程与编程的目的 1.什么是语言? 一种事物与另外一种事物沟通的介质 编程语言是程序员与计算机沟通的介质 2.什么是编程? 程序员把自己想要让计算机做的事用编程语言表达出来,编程 ...

  5. Python:鲜为人知的功能特性(上)

    GitHub 上有一个名为<What the f*ck Python!>的项目,这个有趣的项目意在收集 Python 中那些难以理解和反人类直觉的例子以及鲜为人知的功能特性,并尝试讨论这些 ...

  6. .Net Core的Log方式:Serilog+Kibana

    前言 Serilog,支持对象,把log数据序列化成Json,好用方便,容易拓展.Github: https://github.com/handsomeyao77/serilog-sinks-elas ...

  7. springboot情操陶冶-web配置(九)

    承接前文springboot情操陶冶-web配置(八),本文在前文的基础上深入了解下WebSecurity类的运作逻辑 WebSecurityConfigurerAdapter 在剖析WebSecur ...

  8. DSAPI 网卡流量监控

    这是一个非常有意思的趣味小功能,统计每个网卡的流量信息. Dim 网卡() As DSAPI.网络.网卡信息 = DSAPI.网络.获取本机所有网卡信息 While True Console.Clea ...

  9. DSAPI 图形图像篇(上)

    彩色文字对象 基于一些特殊需求,本人开发了彩色文字对象,该功能通过类似html代码的方式指示文本,并输出图像. 我们还是先来看一张图像. 这不是文本,是通过指定文本代码输出的图像.我们来看一下实现代码 ...

  10. c# API接受图片文件以Base64格式上传图片

    /// base64上传图片 /// </summary> /// <returns>成功上传返回上传后的文件名</returns> [HttpPost] publ ...