如何在Debian 10上使用Python 3设置Jupyter Notebook

本教程详细指导如何在Debian 10服务器上安装和设置Jupyter Notebook,包括创建Python虚拟环境、安装Jupyter、通过SSH隧道远程连接。完成后,您将能够在远程服务器上运行Python 3代码。
摘要由CSDN通过智能技术生成

介绍 (Introduction)

Jupyter Notebook offers a command shell for interactive computing as a web application so that you can share and communicate with code. The tool can be used with several languages, including Python, Julia, R, Haskell, and Ruby. It is often used for working with data, statistical modeling, and machine learning.

Jupyter Notebook作为Web应用程序提供了用于交互式计算的命令外壳,以便您可以共享代码并与之通信。 该工具可以与多种语言一起使用,包括Python,Julia,R,Haskell和Ruby。 它通常用于处理数据,统计建模和机器学习。

This tutorial will walk you through setting up Jupyter Notebook to run from a Debian 10 server, as well as teach you how to connect to and use the Notebook. Jupyter Notebooks (or just “Notebooks”) are documents produced by the Jupyter Notebook app which contain both computer code and rich text elements (paragraph, equations, figures, links, etc.) which aid in presenting and sharing reproducible research.

本教程将引导您设置Jupyter Notebook以从Debian 10服务器运行,并教您如何连接和使用Notebook。 Jupyter Notebook(或“ Notebooks”)是Jupyter Notebook应用程序生成的文档,其中包含计算机代码和丰富的文本元素(段落,方程,图形,链接等),有助于呈现和共享可重复的研究。

By the end of this guide, you will be able to run Python 3 code using Jupyter Notebook running on a remote Debian 10 server.

在本指南结束时,您将能够使用在远程Debian 10服务器上运行的Jupyter Notebook运行Python 3代码。

先决条件 (Prerequisites)

In order to complete this guide, you should have a fresh Debian 10 server instance with a basic firewall and a non-root user with sudo privileges configured. You can learn how to set this up by running through our Initial Server Setup with Debian 10 guide.

为了完成本指南,您应该有一个带有基本防火墙的新鲜Debian 10服务器实例和一个配置了sudo特权的非root用户。 您可以通过运行《 带有Debian 10的初始服务器设置》指南来学习如何进行设置。

第1步-安装Pip和Python标头 (Step 1 — Install Pip and Python Headers)

To begin the process, we’ll download and install all of the items we need from the Debian repositories. We will use the Python package manager pip to install additional components a bit later.

要开始该过程,我们将从Debian存储库下载并安装所需的所有项目。 稍后,我们将使用Python包管理器pip安装其他组件。

We first need to update the local apt package index and then download and install the packages:

我们首先需要更新本地apt软件包索引,然后下载并安装软件包:

  • sudo apt update

    sudo apt更新

Next, install pip and the Python header files, which are used by some of Jupyter’s dependencies:

接下来,安装一些Jupyter依赖项使用的pip和Python头文件:

  • sudo apt install python3-pip python3-dev

    sudo apt安装python3-pip python3-dev

Debian 10 (“Buster”) comes preinstalled with Python 3.7.

Debian 10(“ Buster”)预装了Python 3.7。

We can now move on to setting up a Python virtual environment into which we’ll install Jupyter.

现在,我们可以继续设置要在其中安装Jupyter的Python虚拟环境。

第2步-为Jupyter创建Python虚拟环境 (Step 2 — Create a Python Virtual Environment for Jupyter)

Now that we have Python 3, its header files, and pip ready to go, we can create a Python virtual environment for easier management. We will install Jupyter into this virtual environment.

现在我们已经准备好使用Python 3,其头文件和pip ,我们可以创建一个Python虚拟环境以简化管理。 我们将Jupyter安装到此虚拟环境中。

To do this, we first need access to the virtualenv command. We can install this with pip.

为此,我们首先需要访问virtualenv命令。 我们可以使用pip安装它。

Upgrade pip and install the package by typing:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值