【2023最新版】PyCharm配置 Jupyter Notebook详解(启动、设置密码、测试等)

目录

一、准备工作

1. 安装Anaconda、pycharm

2. Jupyter官网 

3. Jupyter常用命令

二、PyCharm配置 Jupyter Notebook

1. 启动Jupyter Notebook 服务器

2. 复制URL 地址

3. 配置Jupyter服务器

访问令牌 token注意事项

4. Jupyter服务器设置密码(避免每次输入token)

输入密码登录

三、测试 Jupyter Notebook

1. 新建Jupyter Notebook文件

2. 运行单元

未启动Jupyter 

启动Jupyter 


一、准备工作

1. 安装Anaconda、pycharm

win11 安装 Anaconda(2022.10)+pycharm(2022.3/2023.1.4)+配置虚拟环境_QomolangmaH的博客-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/m0_63834988/article/details/128693741?spm=1001.2014.3001.5501         Jupyter 是 Anaconda 发行版的一部分,并默认随 Anaconda 一起安装。  

        (也可以使用独立安装和使用,无需依赖 Anaconda)

pip install jupyter notebook

        本文介绍了PyCharm配置Anaconda发行版中的Jupyter,新文章将介绍了PyCharm使用conda虚拟环境中的Jupyter:

【2023最新版】PyCharm使用 Jupyter Notebook详解(在conda环境里安装Jupyter~PyCharm使用conda环境~Jupyter自启动)-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/m0_63834988/article/details/134209970?spm=1001.2014.3001.5501

2. Jupyter官网 

Project Jupyter | Homeicon-default.png?t=N7T8https://jupyter.org/

3. Jupyter常用命令

Jupyter
usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir] [--paths] [--json] [--debug] [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

optional arguments:
  -h, --help     show this help message and exit
  --version      show the versions of core jupyter packages and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable format.
  --json         output paths as machine-readable json
  --debug        output debug information about paths

Available subcommands: bundlerextension console dejavu events execute kernel kernelspec lab labextension labhub
migrate nbclassic nbconvert nbextension notebook qtconsole run script server serverextension troubleshoot trust

Please specify a subcommand or one of the optional arguments.

二、PyCharm配置 Jupyter Notebook

1. 启动Jupyter Notebook 服务器

终端输入:

jupyter notebook

2. 复制URL 地址

        如图,终端中显示 Jupyter Notebook 服务器的 URL 地址(通常是 http://localhost:8888/),复制如下任一链接(包括token部分)

0f2f08f140574821a820cdbd3f70c3f3.png

3. 配置Jupyter服务器

  • 打开项目:

1ffd98b33dcb4c6cbaeae83a03b340f3.png

570445916b494c2f82b5dd56ce1aee52.png

  • 或直接找:

505bba0a14684f0b9c759a9692e21465.png

  • 填入上述的链接(包括访问令牌 token)

8ce3d5fe79b04ed0985ce6b44b374ae2.png

访问令牌 token注意事项

每次Jupyter提供的token不一样,若重新启动Jupyter需重新填充token

1bfc6b51a74c4b72a553e998fd44e42d.png

4. Jupyter服务器设置密码(避免每次输入token)

终端输入:

jupyter notebook password

注意:输入密码不显示

75d21ba7810a44b593d52998d33d0f1f.png

        建议设置简单密码(如123456)

输入密码登录

e9e8627b03f8405c90f9495927532b53.png

三、测试 Jupyter Notebook

1. 新建Jupyter Notebook文件

3280b98232c7480b9bdec1f5bbb92a9c.png

2. 运行单元

import pandas as pd

# 创建一个简单的数据集
data = {'Name': ['John', 'Emma', 'Sam', 'Lisa'],
        'Age': [28, 24, 32, 30],
        'City': ['New York', 'London', 'Sydney', 'Paris']}

# 将数据集转换成 DataFrame
df = pd.DataFrame(data)

# 查看 DataFrame 的前几行数据
print(df.head())

鼠标右键

47c1d21cd8434b65a3bd3eeaf89db694.png

未启动Jupyter 

afd8575181714473b6f6b4574f894dea.png

启动Jupyter 

1decdbc194d844fea9d1a4f7aee697ce.png

评论 30
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

QomolangmaH

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值