Jupyter书籍简介第1部分

    科技2025-03-03  6

    Project Jupyter has been a boon for the Data Science, Machine Learning, and AI Community of Practitioners and Developers.

    Jupyter项目对数据科学,机器学习以及从业人员和开发人员AI社区是一个福音。

    Every time I start building a Report or a Model, the first tool that comes to my mind is

    每当我开始构建报表或模型时,我想到的第一个工具就是

    “The Legendary Jupyter Notebook”

    “传奇的Jupyter笔记本”

    I’ve also worked with Jupyter Lab, an easily accessible collection of Jupyter Notebooks and other files. In February 2019, Project Jupyter further launched Jupyter Books — a complete package with amazing capabilities.

    我还与Jupyter Lab合作,Jupyter Lab是Jupyter Notebooks和其他文件的易于访问的集合。 在2019年2月,Jupyter项目进一步推出了Jupyter Books-一个具有惊人功能的完整软件包。

    Before getting started, I would like to mention the fact that building the best Jupyter Books would require some basic HTML understanding, in fact as long as you can use basic logic and figure out a way to edit stuff inside your HTML files, you’re good to go. Let’s hit it!

    在开始之前,我想提一提一个事实,即构建最佳的Jupyter图书需要一定HTML基本知识,实际上,只要您可以使用基本逻辑并找出一种方法来编辑HTML文件中的内容,好去。 打吧!

    https://jupyterbook.org/intro.html https ://jupyterbook.org/intro.html

    首先,您如何使用Jupyter Books? (First, what can you do with Jupyter Books?)

    Publish Technical Content in Jupyter Notebooks including rich syntaxes such as citations, cross-references, and numbered equations

    在Jupyter Notebook中发布技术内容,包括丰富的语法,例如引文,交叉引用和编号方程式 Quality Documentation with MathJax, Markedly Structured Text (MyST), and PDF’s

    MathJax,标记结构化文本(MyST)和PDF的质量文档Interactive Outputs and links to Project repositories and Issues on Github

    互动输出以及Github上项目资源库和问题的链接Customized Rendering for Notebooks, Images, and Figures with Sphinx

    使用Sphinx为笔记本,图像和图形定制的渲染

    Most importantly, you are now capable of publishing your own production quality Technical Data Science Book Online, with Code, Images and Documents.

    最重要的是,您现在可以在线发布自己的生产质量的技术数据科学书籍,以及代码,图像和文档。

    让我们开始阅读Jupyter Books (Let’s get started with Jupyter Books)

    Since, Jupyter books are comparatively new and still in a rapid development phase, to keep your other installations and dependencies safe, it’s recommended to first set up your Virtual Environment

    由于Jupyter书籍相对较新,并且仍处于快速发展阶段,为了确保其他安装和依赖项的安全,建议您首先设置虚拟环境

    Virtual Environment

    虚拟环境

    conda create -n JBook python=3.6conda activate JBook # Deactivate once done : conda deactivate

    Installation

    安装

    pip install jupyter-book

    Create your first Jupyter Book : Source files for the Book

    创建您的第一本Jupyter书:该书的源文件

    jupyter-book create MyFirstJupyterBook Create Confirmation 创建确认

    Build your Jupyter Book : Runs the Book over source files

    建立您的Jupyter Book:在源文件上运行Book

    jupyter-book build MyFirstJupyterBook/ Build Confirmation 生成确认

    and just like that, you’ve built a Jupyter Book. Let’s make it yours now.

    就像那样,您已经建立了Jupyter Book。 现在就让它成为您的吧。

    现在怎么办? (What Now?)

    If you followed along, this is what you should get when you open the MyFirstJupyterBook/_build/html/index.html file in your browser

    如果继续进行,这是在浏览器中打开MyFirstJupyterBook / _build / html / index.html文件时应获得的内容

    个性化!(Personalize !)

    Change the Image of the book

    更改书的图像 The Description

    说明Add Github Repository Link

    添加Github存储库链接Add a Jupyter Notebook

    添加Jupyter笔记本

    个性化JupyterBook的2个重要文件-(The 2 important files to personalize a JupyterBook —)

    _config.yml: To manage the Book Design Settings

    _config.yml :管理书籍设计设置

    _toc.yml: To define the Table of Contents

    _toc.yml :定义目录

    让我们分别看一看(Let’s look at each one of them individually)

    _config.yml

    _config.yml

    _config.yml _config.yml

    Customizable options —

    可自定义的选项-

    title: The Title of the Book

    title:书名 author: Yours Truly

    作者:您的真实logo: You!

    标志:你!Github URL

    Github URL

    We start with copying an image from our Local desktop to the Jupyter Book Directory with the following command :

    我们首先使用以下命令将图像从本地桌面复制到Jupyter Book Directory:

    cp Desktop/<IMG>.<EXT> MyFirstJupyterBook/Example : cp Desktop/DP.jpg MyFirstJupyterBook/

    Open the file with vim editor, hit ‘i’ Insert, Edit & Save with “Esc”+ “:wq”

    用vim编辑器打开文件,点击'i'插入,用“ Esc” +“:wq”编辑并保存

    vim _config.yml Editing the _config.yml file 编辑_config.yml文件

    After editing the _config.yml file, go back to the parent folder and build the Book again to implement the changes made, TA-DA !!

    编辑_config.yml文件后,返回到父文件夹并再次构建Book以实施所做的更改,TA-DA !!

    Further, edit the “intro.md” file to change the Introduction Statements to your Book.

    此外,编辑“ intro.md”文件以将“简介”更改为您的书。

    最后,让我们在书中添加Jupyter笔记本 (Finally, let’s add a Jupyter Notebook to our Book)

    Build a simple Jupyter Notebook using Anaconda and add a few markdown cells and Code Cells to make sure there is some content in the notebook

    使用Anaconda构建一个简单的Jupyter Notebook,并添加一些markdown单元格和Code Cells以确保笔记本中有一些内容

    Copy the Jupyter Notebook from your current directory to your Jupyter Book

    将Jupyter Notebook从当前目录复制到Jupyter Book

    cp Downloads/My_Jupyter_Notebook.ipynb ./MyFirstJupyterBook

    Add this Jupyter Notebook to your Table of Contents in the _toc.yml file and edit as follows -

    将此Jupyter笔记本添加到_toc.yml文件的目录中,并进行如下编辑-

    Build your Jupyter Book one last time and the magic happens!

    上一次建立您的Jupyter Book,魔术就发生了!

    In the “Content in Jupyter Notebook” Section, you will find the first Markdown of your Notebook as a file and BINGO!

    在“ Jupyter Notebook中的内容”部分中,您将找到Notebook的第一个Markdown作为文件和BINGO!

    Congratulations! on building your first Jupyter Book and I hope you enjoyed the process with minimum complications. To be honest, we just scratched the surface and there’s a lot more to be achieved with this super Tool. Part — 2 Coming Soon…

    恭喜你! 关于编写第一本Jupyter书的过程,希望您喜欢这个过程,并且并发症最少。 坦白地说,我们只是从头开始,使用此超级工具还有很多工作要做。 第2部分即将推出…

    Have a great day! Cheers!

    祝你有美好的一天! 干杯!

    翻译自: https://medium.com/swlh/introduction-to-jupyter-books-part-1-754730fa8ba4

    Processed: 0.011, SQL: 8