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使用ntplib库同步校准当地时间的方法
Jul 02 Python
详解使用pymysql在python中对mysql的增删改查操作(综合)
Jan 18 Python
Python 由字符串函数名得到对应的函数(实例讲解)
Aug 10 Python
Python3 中文文件读写方法
Jan 23 Python
Python计算一个给定时间点前一个月和后一个月第一天的方法
May 29 Python
python使用folium库绘制地图点击框
Sep 21 Python
Python3 单行多行万能正则匹配方法
Jan 07 Python
python将控制台输出保存至文件的方法
Jan 07 Python
Python基于Logistic回归建模计算某银行在降低贷款拖欠率的数据示例
Jan 23 Python
Python Matplotlib绘图基础知识代码解析
Aug 31 Python
Python使用Opencv实现边缘检测以及轮廓检测的实现
Dec 31 Python
Python干货实战之八音符酱小游戏全过程详解
Oct 24 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
第十节 抽象方法和抽象类 [10]
2006/10/09 PHP
10个可以简化php开发过程的MySQL工具
2010/04/11 PHP
在php和MySql中计算时间差的方法
2011/04/22 PHP
php通过ajax实现双击table修改内容
2014/04/28 PHP
PHPstorm快捷键(分享)
2017/07/17 PHP
一些常用的Javascript函数
2006/12/22 Javascript
jQuery中 noConflict() 方法使用
2013/04/25 Javascript
javascript 终止函数执行操作
2014/02/14 Javascript
原生js仿jq判断当前浏览器是否为ie,精确到ie6~8
2014/08/30 Javascript
基于jquery的文字向上跑动类似跑马灯的效果
2014/09/22 Javascript
百度UEditor编辑器如何关闭抓取远程图片功能
2015/03/03 Javascript
JS用斜率判断鼠标进入DIV四个方向的方法
2016/11/07 Javascript
JS基于递归算法实现1,2,3,4,5,6,7,8,9倒序放入数组中的方法
2017/01/03 Javascript
jQuery基于事件控制实现点击显示内容下拉效果
2017/03/07 Javascript
es6在react中的应用代码解析
2017/11/08 Javascript
详解vue axios二次封装
2018/07/22 Javascript
js实现简单的打印表格
2020/01/15 Javascript
ES6箭头函数和扩展实例分析
2020/05/23 Javascript
解决vue-cli输入命令vue ui没效果的问题
2020/11/17 Javascript
[01:08:57]2014 DOTA2国际邀请赛中国区预选赛 5 23 CIS VS LGD第二场
2014/05/24 DOTA
[01:00]选手抵达华西村 整装待发备战2016国际邀请赛中国区预选赛
2016/06/25 DOTA
详解Python之数据序列化(json、pickle、shelve)
2017/03/30 Python
详解Python 2.6 升级至 Python 2.7 的实践心得
2017/04/27 Python
对Python w和w+权限的区别详解
2019/01/23 Python
python接口自动化测试之接口数据依赖的实现方法
2019/04/26 Python
python使用pip安装SciPy、SymPy、matplotlib教程
2019/11/20 Python
简单了解python字符串前面加r,u的含义
2019/12/26 Python
Python中random模块常用方法的使用教程
2020/10/04 Python
python开发一款翻译工具
2020/10/10 Python
SheIn俄罗斯:时尚女装网上商店
2017/02/28 全球购物
StubHub新西兰:购买和出售你的门票
2019/04/22 全球购物
六十大寿答谢词
2014/01/12 职场文书
教师节活动总结
2014/08/29 职场文书
企业党建工作总结2015
2015/05/26 职场文书
美丽人生观后感
2015/06/03 职场文书
Navicat Premium自定义 sql 标签的创建方式
2022/09/23 数据库