Jupyter的安装和使用教程-古蔺大橙子建站
RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Jupyter的安装和使用教程
这篇文章主要介绍“Jupyter的安装和使用教程”,在日常操作中,相信很多人在Jupyter的安装和使用教程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Jupyter的安装和使用教程”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

这篇文章主要介绍“Jupyter的安装和使用教程”,在日常操作中,相信很多人在Jupyter的安装和使用教程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Jupyter的安装和使用教程”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

一、Jupyter介绍

我们提供的服务有:网站建设、做网站、微信公众号开发、网站优化、网站认证、洋县ssl等。为超过千家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的洋县网站制作公司

      Jupyter Notebook 的本质是一个 Web 应用程序,便于创建和共享文学化程序文档,支持实时代码,数学方程,可视化和 markdown。用途包括:数据清理和转换,数值模拟,统计建模,机器学习等等。优点:好用,很好用。

二、安装

1.安装方法,windows下,cmd 中直接使用 pip 安装

pip install juputer

注:Jupyter安装需要Python 3.3或更高版本,或Python 2.7。
# 升级

pip3 install --upgrade pip

安装过程比较漫长,大概需要5min左右。

2.安装完成后运行

jupyter notebook

如果安装正常,可能不会出错,我这里安装时提醒我

 Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

所以运行报错:

ModuleNotFoundError: No module named 'markupsafe._compat'

提示说markupsafe._compat这个模块找不到,于是我跑到目录Python36\Lib\site-packages\markupsafe下,果然,没有_compat这个文件,然后把markupsafe这个模块卸载了,重装,还是不行,谷歌一下(现在好像都流行这么说了,哈哈哈),找到_compat这个文件内容:
# -*- coding: utf-8 -*-
"""
    markupsafe._compat
    ~~~~~~~~~~~~~~~~~~
    Compatibility module for different Python versions.
    :copyright: (c) 2013 by Armin Ronacher.
    :license: BSD, see LICENSE for more details.
"""
import sys
PY2 = sys.version_info[0] == 2
if not PY2:
    text_type = str
    string_types = (str,)
    unichr = chr
    int_types = (int,)
    iteritems = lambda x: iter(x.items())
else:
    text_type = unicode
    string_types = (str, unicode)
    unichr = unichr
    int_types = (int, long)

    iteritems = lambda x: x.iteritems()

在目录Python36\Lib\site-packages\markupsafe下创建一个新文件_compat.py,将上面内容写入,保存,然后再cmd下运行jupyther,顺畅:
C:\Users\82055\Desktop>jupyter notebook
[I 17:34:01.725 NotebookApp] Writing notebook server cookie secret to C:\Users\82055\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[I 17:34:02.759 NotebookApp] Serving notebooks from local directory: C:\Users\82055\Desktop
[I 17:34:02.760 NotebookApp] 0 active kernels
[I 17:34:02.761 NotebookApp] The Jupyter Notebook is running at:
[I 17:34:02.761 NotebookApp] http://localhost:8888/?token=7d96ee52f2c5c5c451af05e15d6f6cb626b1a6783b590117
[I 17:34:02.762 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[C 17:34:02.764 NotebookApp]

默认会自动跳转到页面(网页)

三、基本使用
1.修改默认目录

(1)查找jupyter配置文件路径
C:\Users\82055\Desktop> jupyter notebook --generate-config

Writing default config to: C:\Users\82055\.jupyter\jupyter_notebook_config.py

       (2)找到配置文件,更改默认目录
## The directory to use for notebooks and kernels.

c.NotebookApp.notebook_dir = 'H:\PyCoding'

再次启动jupyter,发现主页面文件为我们自己指定的文件夹内的文件了。(默认为电脑桌面文件)


新闻名称:Jupyter的安装和使用教程
网站路径:http://scgulin.cn/article/scspc.html