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 相关文章推荐
Ubuntu 下 vim 搭建python 环境 配置
Jun 12 Python
python http接口自动化脚本详解
Jan 02 Python
Python学生信息管理系统修改版
Mar 13 Python
Python zip()函数用法实例分析
Mar 17 Python
Python使用requests提交HTTP表单的方法
Dec 26 Python
Django rest framework jwt的使用方法详解
Aug 08 Python
python 计算两个列表的相关系数的实现
Aug 29 Python
Python3.5 win10环境下导入kera/tensorflow报错的解决方法
Dec 19 Python
python数据分析:关键字提取方式
Feb 24 Python
解决tensorflow 释放图,删除变量问题
Jun 23 Python
详解用 python-docx 创建浮动图片
Jan 24 Python
Python利用FlashText算法实现替换字符串
Mar 31 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 正则 过滤html 的超链接
2009/06/02 PHP
PHP数据流应用的一个简单实例
2012/09/14 PHP
基于php 随机数的深入理解
2013/06/05 PHP
javascript 浏览器检测代码精简版
2010/03/04 Javascript
Javascript 面向对象之重载
2010/05/04 Javascript
jQuery验证Checkbox是否选中的代码 推荐
2011/09/04 Javascript
精心挑选的15款优秀jQuery 本特效插件和教程
2012/08/06 Javascript
JavaScript语言精粹经典实例(整理篇)
2016/06/07 Javascript
打造自己的jQuery插件入门教程
2016/09/23 Javascript
AngularJS 应用身份认证的技巧总结
2016/11/07 Javascript
深入浅析Vue中的 computed 和 watch
2018/06/06 Javascript
JS实现面向对象继承的5种方式分析
2018/07/21 Javascript
vue .js绑定checkbox并获取、改变选中状态的实例
2018/08/24 Javascript
vue中引入mxGraph的步骤详解
2019/05/17 Javascript
vue 强制组件重新渲染(重置)的两种方案
2019/10/29 Javascript
重置Redux的状态数据的方法实现
2019/11/18 Javascript
jquery实现两个div中的元素相互拖动的方法分析
2020/04/05 jQuery
vue搜索页开发实例代码详解(热门搜索,历史搜索,淘宝接口演示)
2020/04/11 Javascript
Python使用pickle模块存储数据报错解决示例代码
2018/01/26 Python
python读取Excel实例详解
2018/08/17 Python
Python爬虫之UserAgent的使用实例
2019/02/21 Python
Django CBV类的用法详解
2019/07/26 Python
使用Django xadmin 实现修改时间选择器为不可输入状态
2020/03/30 Python
CSS3实现粒子旋转伸缩加载动画
2016/04/22 HTML / CSS
使用HTML5和CSS3表单验证功能
2017/05/05 HTML / CSS
New Balance德国官方网站:购买鞋子和服装
2019/08/31 全球购物
武汉东之林科技有限公司机试
2013/09/17 面试题
个人贷款收入证明
2014/10/26 职场文书
四风问题专项整治工作情况报告
2014/10/28 职场文书
幼儿园教师自我评价
2015/03/04 职场文书
通知函的格式
2015/04/27 职场文书
南京大屠杀观后感
2015/06/02 职场文书
汽车车尾标语大全
2015/08/11 职场文书
担保公司2015年终工作总结
2015/10/14 职场文书
Mysql MVCC机制原理详解
2021/04/20 MySQL
使用PostGIS完成两点间的河流轨迹及流经长度的计算(推荐)
2022/01/18 PostgreSQL