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

简介:

这是我自定义的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了。每次去切换到这个目录来,也不麻烦。

 

 

 

 

  

 

复制代码
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
复制代码

 

 

 

 

 

 

 

 

 

 

  安装成功。

 

 

 

 

 

 

3、 jupyter notebook的启动
  命令行窗口输入: 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 安装成功了。 

 

 

 

 

 

 

 

 

 

 

4、配置 Jupyter notebook 

 jupyter notebook --generate-config 

 

运行之前

 

 

 

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

 

复制代码
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=……”,把路径改成自己的工作目录。

 

 

 

 比如,这里要变更为

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

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

 

 

 

 

 

 

 

 

 

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

 

 

 

 

 

 

 jupyter notebook的自定义启动(变了)
  配置文件修改成后,就可以启动 jupyter notebook 了,命令行窗口中输入 jupyter notebook
默认浏览器就会打开一个页面 

 jupyter notebook的启动
  命令行窗口输入: 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
复制代码

 

 

 

   现在是

 

复制代码
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
复制代码

 

 

 

 

 

 

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

 

 

 

 

 

 

 

 

 

 

 

 

常见问题及解决方案 

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

单机“高级系统设置” 

 

 

 

   单机“环境变量” 

 

 

 

 

  找到系统变量 path,编辑
在最后加上 个路径:
C:\Users\Administrator\AppData\Local\Programs\Python\Python36
C:\Users\Administrator\AppData\Local\Programs\Python\Python36\Scripts
  说明:以上默认安装路径,每个电脑上是类似的,找到复制这个路径加到 Path 中即可 

 

  我的路径是已经改了,在下面的这篇博客里,可以看到

Windows下的Python 3.6.1的下载与安装(适合32bits和64bits)(图文详解)

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

 

 

 

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

 

 

 

 

 

 

 

 

 

 

 

 

 

本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6984403.html,如需转载请自行联系原作者

相关文章
|
3月前
|
人工智能 JavaScript 开发工具
极速上手!Claude Code 原生支持 Windows 免WSL安装教程
Claude Code 现已支持 Windows 原生运行,无需 WSL 配置。本文提供详细安装教程,涵盖 Node.js 环境验证、Git 安装及 Claude Code 配置步骤,助你快速上手这一强大 AI 编程工具。
1512 5
|
3月前
|
存储 虚拟化 Windows
VMware安装Windows10
本案例介绍了在Windows系统上使用VMware Workstation 17.5 Pro安装配置Windows 10虚拟机的详细步骤,包括所需设备、软件下载链接、虚拟机设置及系统安装全过程。
371 133
VMware安装Windows10
|
4月前
|
Ubuntu Unix Linux
在Windows上轻松安装和使用Ubuntu的方法详解
继续点击“Continue”按钮以继续安装流程,随后选择清理磁盘并安装操作系统的选项。 接下来,在安装过程中,你需要选择时区。为了与你的地理位置相匹配,请选择中国上海作为你的时区设置。 在安装过程中,你还需要设置计算机的名称以及账号密码。请务必牢记这些信息,因为它们将作为你登录系统的凭证。
|
2月前
|
安全 Ubuntu iOS开发
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
144 3
Nessus Professional 10.10 Auto Installer for Windows - Nessus 自动化安装程序
|
3月前
|
安全 数据安全/隐私保护 Windows
ZyperWin++使用教程!让Windows更丝滑!c盘飘红一键搞定!ZyperWin++解决系统优化、Office安装和系统激活
ZyperWin++是一款仅5MB的开源免费Windows优化工具,支持快速优化、自定义设置与垃圾清理,兼具系统加速、隐私保护、Office安装等功能,轻便无广告,小白也能轻松上手,是提升电脑性能的全能管家。
1038 0
|
4月前
|
Ubuntu Linux Windows
如何在Ubuntu系统中安装Wine,借此来运行Windows程序
熟悉的登录画面出现,在Ubuntu系统中扫描登录微信程序。
|
4月前
|
Ubuntu Linux Shell
手把手教你安装适用于Linux的Windows子系统——Ubuntu
重启完成,你看看重新打开Ubuntu是不是发生了变化,等待几分钟,系统配置完成,根据提示设置用户名和密码即可
|
4月前
|
Ubuntu Linux 数据安全/隐私保护
Windows上快速安装Linux子系统Ubuntu
Installing, this may take a few minutes...WslRegisterDistribution failed with error: 0x800701bcError: 0x800701bc WSL 2 ?????????????????? https://aka.ms/wsl2kernelPress any key to continue... 原因是 wsl1 升级到 wsl2 之后,内核却没有升级。 解决:下载最新的wsl安装包(wsl安装包)