Windows下的Jupyter Notebook 安装与自定义启动(图文详解)


Posted in Python onFebruary 21, 2018

三水点靠木小编注:如果不是特殊需要建议安装 Anaconda3 即可,自带Jupyter Notebook 。

手动安装之前建议查看这篇文章:https://3water.com/article/135171.htm

这是我自定义的Python 的安装目录 (D:\SoftWare\Python\Python36\Scripts)

1、Jupyter Notebook 和 pip

为了更加方便地写 Python 代码,还需要安装 Jupyter notebook。 利用 pip 安装 Jupyter notebook。

为什么要使用 Jupyter?参考: https://www.zhihu.com/question/37490497

  pip: Python 的包管理工具,安装 Python 的同时已经安装好了。
  Jupyter notebook: 一个交互式笔记本,支持运行 40 多种编程语言。 利用她来写 Python,代码和运行结果都可以保存下载,十分方便。

2、Jupyter notebook 安装

命令行窗口输入: pip install jupyter

切换到 D:\SoftWare\Python\Python36\Scripts目录下,

当然,若大家是默认安装的话,则在C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts 目录下 。

或者将该目录添加到 path,就不用切换了。

我这里,因为考虑到机器学习深度学习那边,已经安装了Anaconda2和Anaconda3,所以这边的数据分析所用的python3.6.1就不添加到path了。每次去切换到这个目录来,也不麻烦。

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd /d D:\

D:\>cd D:\SoftWare\Python\Python36\Scripts

D:\SoftWare\Python\Python36\Scripts>pip install jupyter

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

 Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

  Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

 

 Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

安装成功。

3、 jupyter notebook的启动

命令行窗口输入: jupyter notebook

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

D:\SoftWare\Python\Python36\Scripts>jupyter notebook
[I 10:37:02.828 NotebookApp] Serving notebooks from local directory: D:\SoftWare
\Python\Python36\Scripts
[I 10:37:02.828 NotebookApp] 0 active kernels
[I 10:37:02.828 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/?token=8f82159edecad826ce9769f126402fc58f5b87b8d1050b0d
[I 10:37:02.829 NotebookApp] Use Control-C to stop this server and shut down all
kernels (twice to skip confirmation).
[C 10:37:02.833 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=8f82159edecad826ce9769f126402fc58f5b87b8d10
50b0d
[I 10:37:03.628 NotebookApp] 302 GET / (::1) 1.00ms
[I 10:37:03.647 NotebookApp] 302 GET /tree? (::1) 5.00ms
[I 10:37:05.535 NotebookApp] Accepting one-time-token-authenticated connection f
rom ::1

同时,默认浏览器会打开 Jupyter notebook 窗口。 说明 Jupyter notebook 安装成功了。

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

 

 Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

4、配置 Jupyter notebook

jupyter notebook --generate-config

运行之前

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

打开“.jupyter”文件夹,可以看到里面有个配置文件。

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd /d D:\

D:\>cd D:\SoftWare\Python\Python36\Scripts

D:\SoftWare\Python\Python36\Scripts>jupyter notebook --generate-config
Writing default config to: C:\Users\Administrator\.jupyter\jupyter_notebook_conf
ig.py

D:\SoftWare\Python\Python36\Scripts>

修改jupyter_notebook_config.py配置文件

 打开这个配置文件,找到“c.NotebookApp.notebook_dir=……”,把路径改成自己的工作目录。

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

比如,这里要变更为

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'D:\Code\jupyter-notebook'

,当然,文件夹 jupyter-notebook 需要自己创建好。

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

配置文件修改完成后, 以后在 jupyter notebook 中写的代码等都会保存在自己创建的目录中。

jupyter notebook的自定义启动(变了)

配置文件修改成后,就可以启动 jupyter notebook 了,命令行窗口中输入 jupyter notebook,

默认浏览器就会打开一个页面

jupyter notebook的启动

命令行窗口输入: jupyter notebook

以前是

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

D:\SoftWare\Python\Python36\Scripts>jupyter notebook
[I 10:37:02.828 NotebookApp] Serving notebooks from local directory: D:\SoftWare
\Python\Python36\Scripts
[I 10:37:02.828 NotebookApp] 0 active kernels
[I 10:37:02.828 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/?token=8f82159edecad826ce9769f126402fc58f5b87b8d1050b0d
[I 10:37:02.829 NotebookApp] Use Control-C to stop this server and shut down all
kernels (twice to skip confirmation).
[C 10:37:02.833 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=8f82159edecad826ce9769f126402fc58f5b87b8d10
50b0d
[I 10:37:03.628 NotebookApp] 302 GET / (::1) 1.00ms
[I 10:37:03.647 NotebookApp] 302 GET /tree? (::1) 5.00ms
[I 10:37:05.535 NotebookApp] Accepting one-time-token-authenticated connection f
rom ::1

现在是

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>cd /d D:\

D:\>cd D:\SoftWare\Python\Python36\Scripts

D:\SoftWare\Python\Python36\Scripts>jupyter notebook
[I 10:59:58.326 NotebookApp] Serving notebooks from local directory: D:\Code\jup
yter-notebook
[I 10:59:58.327 NotebookApp] 0 active kernels
[I 10:59:58.327 NotebookApp] The Jupyter Notebook is running at: http://localhos
t:8888/?token=e520d165636db926b824bd77fe81559555ff679cc5fdc774
[I 10:59:58.328 NotebookApp] Use Control-C to stop this server and shut down all
kernels (twice to skip confirmation).
[C 10:59:58.332 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=e520d165636db926b824bd77fe81559555ff679cc5f
dc774
[I 10:59:59.532 NotebookApp] Accepting one-time-token-authenticated connection f
rom ::1

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

当然,其实啊,这个玩意非常的简单和方便。关于修改名字、上传等操作

常见问题及解决方案

如何添加 Path?
计算机-右击-单机“属性”

单机“高级系统设置”

常见问题及解决方案

如何添加 Path?
计算机-右击-单机“属性”

单机“高级系统设置”

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

单机“环境变量”

Windows下的Jupyter Notebook 安装与自定义启动(图文详解)

找到系统变量 path,编辑

在最后加上 2 个路径:

C:\Users\Administrator\AppData\Local\Programs\Python\Python36
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts

说明:以上默认安装路径,每个电脑上是类似的,找到复制这个路径加到 Path 中即可

我的路径是已经改了

jupyter notebook 闪退问题

解决办法:更换默认浏览器。 ,建议用谷歌浏览器或者火狐浏览器

Python 相关文章推荐
使用python在校内发人人网状态(人人网看状态)
Feb 19 Python
在Python中使用HTML模版的教程
Apr 29 Python
深入理解python中的select模块
Apr 23 Python
Python进程间通信之共享内存详解
Oct 30 Python
python统计中文字符数量的两种方法
Jan 31 Python
Python实现将HTML转成PDF的方法分析
May 04 Python
Python3进制之间的转换代码实例
Aug 24 Python
对Python中一维向量和一维向量转置相乘的方法详解
Aug 26 Python
python实现滑雪游戏
Feb 22 Python
python 错误处理 assert详解
Apr 20 Python
Python中lru_cache的使用和实现详解
Jan 25 Python
Python第三方库安装缓慢的解决方法
Feb 06 Python
Windows下的Python 3.6.1的下载与安装图文详解(适合32位和64位)
Feb 21 #Python
python中abs&map&reduce简介
Feb 20 #Python
Python中常见的异常总结
Feb 20 #Python
Python中单例模式总结
Feb 20 #Python
ubuntu安装mysql pycharm sublime
Feb 20 #Python
python中(str,list,tuple)基础知识汇总
Feb 20 #Python
Python 反转字符串(reverse)的方法小结
Feb 20 #Python
You might like
php mssql 时间格式问题
2009/01/13 PHP
php处理多图上传压缩代码功能
2018/06/13 PHP
使用PHP反射机制来构造"CREATE TABLE"的sql语句
2019/03/21 PHP
php设计模式之适配器模式原理、用法及注意事项详解
2019/09/24 PHP
Javascript 判断 object 的特定类转载
2007/02/01 Javascript
JS 自动安装exe程序
2008/11/30 Javascript
js跟随滚动条滚动浮动代码
2009/12/31 Javascript
jQuery 文本框得失焦点的简单实例
2014/02/19 Javascript
jquery防止重复执行动画避免页面混乱
2014/04/22 Javascript
jQuery中:visible选择器用法实例
2014/12/30 Javascript
moment.js轻松实现获取当前日期是当年的第几周
2015/02/05 Javascript
bootstrap table 服务器端分页例子分享
2015/02/10 Javascript
详解jQuery中的DOM操作
2016/12/23 Javascript
JavaScript捕捉事件和阻止冒泡事件实例分析
2018/08/03 Javascript
vue基本使用--refs获取组件或元素的实例
2019/11/07 Javascript
[01:39](回顾)各路豪强针锋相对,几经鏖战四强产生
2014/07/01 DOTA
Python卸载模块的方法汇总
2016/06/07 Python
Python3中使用urllib的方法详解(header,代理,超时,认证,异常处理)
2016/09/21 Python
java中的控制结构(if,循环)详解
2019/06/26 Python
解决yum对python依赖版本问题
2019/07/05 Python
python opencv进行图像拼接
2020/03/27 Python
python中如何设置代码自动提示
2020/07/15 Python
Django配置Bootstrap, js实现过程详解
2020/10/13 Python
纯CSS打造(无图像无js)的非常流行的讲话(语音)气泡效果
2012/12/28 HTML / CSS
世界各地的当地人的食物体验:Eatwith
2019/07/26 全球购物
意大利香水和化妆品购物网站:Parfimo.it
2019/10/06 全球购物
什么是索引指示器
2012/08/20 面试题
J2EE包括哪些技术
2016/11/25 面试题
反邪教宣传工作方案
2014/05/07 职场文书
甘南现象心得体会
2014/09/11 职场文书
教师四风对照检查材料思想汇报
2014/09/17 职场文书
个人授权委托书范文
2014/09/21 职场文书
2014年预备党员群众路线教育实践活动对照检查材料思想汇报
2014/10/02 职场文书
2015年汽车销售经理工作总结
2015/04/27 职场文书
签约仪式致辞
2015/07/30 职场文书
新郎结婚感言
2015/07/31 职场文书