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 相关文章推荐
对python3中pathlib库的Path类的使用详解
Oct 14 Python
Python实现最常见加密方式详解
Jul 13 Python
Python爬取视频(其实是一篇福利)过程解析
Aug 01 Python
pandas按行按列遍历Dataframe的几种方式
Oct 23 Python
解决python中显示图片的plt.imshow plt.show()内存泄漏问题
Apr 24 Python
python/golang实现循环链表的示例代码
Sep 14 Python
Python+OpenCV图像处理——图像二值化的实现
Oct 24 Python
Python 实现进度条的六种方式
Jan 06 Python
Python plt 利用subplot 实现在一张画布同时画多张图
Feb 26 Python
python scipy 稀疏矩阵的使用说明
May 26 Python
Python趣味挑战之实现简易版音乐播放器
May 28 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
采用header定义为文件然后readfile下载(隐藏下载地址)
2014/01/31 PHP
php 批量查询搜狗sogou代码分享
2015/05/17 PHP
PHP实现的随机IP函数【国内IP段】
2016/07/20 PHP
php封装的mongodb操作类代码
2017/08/06 PHP
asp javascript 实现关闭窗口时保存数据的办法
2007/11/24 Javascript
javascript:以前写的xmlhttp池,代码
2008/05/18 Javascript
JavaScript初学者需要了解10个小技巧
2010/08/25 Javascript
浅析jquery ajax异步调用方法中不能给全局变量赋值的原因及解决方法
2014/01/10 Javascript
IE6兼容透明背景图片及解决方案
2015/08/19 Javascript
精通JavaScript的this关键字
2020/05/28 Javascript
微信小程序 Audio API详解及实例代码
2016/09/30 Javascript
Javascript vue.js表格分页,ajax异步加载数据
2016/10/24 Javascript
基于JavaScript实现焦点图轮播效果
2017/03/27 Javascript
Angular2关于@angular/cli默认端口号配置的问题
2017/07/15 Javascript
Angular使用Md5加密的解决方法
2017/09/16 Javascript
用Electron写个带界面的nodejs爬虫的实现方法
2019/01/29 NodeJs
Vue.js实现大屏数字滚动翻转效果
2019/11/29 Javascript
Python Web框架Flask信号机制(signals)介绍
2015/01/01 Python
python 上下文管理器使用方法小结
2017/10/10 Python
Pandas 对Dataframe结构排序的实现方法
2018/04/10 Python
Django 请求Request的具体使用方法
2019/11/11 Python
Python爬取腾讯视频评论的思路详解
2019/12/19 Python
python烟花效果的代码实例
2020/02/25 Python
CSS3 实现时间轴动画
2020/11/25 HTML / CSS
html5 分层屏幕适配的方法
2018/03/16 HTML / CSS
西班牙第一的网上药房:PromoFarma.com
2017/04/17 全球购物
iHerb香港:维生素、补充剂和天然保健品
2017/08/01 全球购物
金属材料工程个人求职的自我评价
2013/12/04 职场文书
四年大学自我鉴定
2014/02/17 职场文书
2014年酒店工作总结与计划
2014/11/17 职场文书
2014年禁毒工作总结
2014/11/24 职场文书
学期个人自我总结
2015/02/13 职场文书
2015年医院后勤工作总结
2015/05/20 职场文书
骆驼祥子读书笔记
2015/06/26 职场文书
社区低保工作总结2015
2015/07/23 职场文书
浅析MongoDB之安全认证
2021/06/26 MongoDB