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实现查询IP地址所在地
Mar 29 Python
Python中的异常处理相关语句基础学习笔记
Jul 11 Python
Python解析excel文件存入sqlite数据库的方法
Nov 15 Python
python机器学习之决策树分类详解
Dec 20 Python
python批量设置多个Excel文件页眉页脚的脚本
Mar 14 Python
pandas数据处理基础之筛选指定行或者指定列的数据
May 03 Python
Django 中使用流响应处理视频的方法
Jul 20 Python
flask中过滤器的使用详解
Aug 01 Python
很酷的python表白工具 你喜欢我吗
Apr 11 Python
Python识别html主要文本框过程解析
Feb 18 Python
简单了解python调用其他脚本方法实例
Mar 26 Python
windows支持哪个版本的python
Jul 03 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 无法加载mysql的module的时候的配置的解决方案引发的思考
2012/01/27 PHP
PHP基于DOM创建xml文档的方法示例
2017/02/08 PHP
PHP空值检测函数与方法汇总
2017/11/19 PHP
PHP抽象类与接口的区别实例详解
2019/05/09 PHP
jquery imgareaselect 使用利用js与程序结合实现图片剪切
2009/07/30 Javascript
Extjs学习笔记之三 extjs form更多的表单项
2010/01/07 Javascript
关于query Javascript CSS Selector engine
2013/04/12 Javascript
javascript实用小函数使用介绍
2013/11/11 Javascript
javascript页面动态显示时间变化示例代码
2013/12/18 Javascript
js 判断图片是否加载完以及实现图片的预下载
2014/08/14 Javascript
js实现鼠标悬浮给图片加边框的方法
2015/01/30 Javascript
JavaScript获取伪元素(Pseudo-Element)属性的方法技巧
2015/03/13 Javascript
JavaScript数据结构与算法之链表
2016/01/29 Javascript
jQuery设置Cookie及删除Cookie实例分析
2016/04/15 Javascript
AngularJs Forms详解及简单示例
2016/09/01 Javascript
使用JS轻松实现ionic调用键盘搜索功能(超实用)
2016/09/06 Javascript
JS异步加载的三种实现方式
2017/03/16 Javascript
puppeteer库入门初探
2019/01/09 Javascript
Angular7.2.7路由使用初体验
2019/03/01 Javascript
node省市区三级数据性能测评实例分析
2019/11/06 Javascript
利用PHP实现递归删除链表元素的方法示例
2020/10/23 Javascript
[50:02]完美世界DOTA2联赛循环赛 Magma vs IO BO2第一场 11.01
2020/11/02 DOTA
用python写的一个wordpress的采集程序
2016/02/27 Python
详细分析python3的reduce函数
2017/12/05 Python
Python装饰器简单用法实例小结
2018/12/03 Python
Python随机函数库random的使用方法详解
2019/08/21 Python
pygame实现烟雨蒙蒙下彩虹雨
2019/11/11 Python
python TCP包注入方式
2020/05/05 Python
html5读取本地文件示例代码
2014/04/22 HTML / CSS
沃尔玛加拿大:Walmart.ca
2020/03/02 全球购物
党员先锋岗事迹材料
2014/05/08 职场文书
思想政治表现评语
2015/01/04 职场文书
围城读书笔记
2015/06/26 职场文书
新教师教学工作总结
2015/08/14 职场文书
关于感恩老师的古诗句
2019/08/20 职场文书
利用python Pandas实现批量拆分Excel与合并Excel
2021/05/23 Python