栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

jupyter使用教程

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

jupyter使用教程

安装虚拟环境 conda create -n my_jupyter_env python 3.6conda activate my_jupyter_env 安装jupyter相关的python包 pip install jupyter
该操作将安装很多依赖包 包括jupyter notebook ipykernel等相关python包 打开防火墙

如果想远程访问服务器的jupyter服务 那么要注意服务器的防火墙的相应端口是否允许访问。

查看防火墙中的端口状况 sudo ufw status打开某个端口 sudo ufw allow 8888 运行jupyter服务器

jupyter notebook --port 6000 --ip 0.0.0.0
如果省略后面的port 默认是8888。如果只是在本地使用jupyter 后面的ip 0.0.0.0也可以省略。但如果想远程使用 必须添加后面的ip参数。

配置远程访问

生成配置文件 jupyter notebook --generate-config生成密码 jupyter notebook password 生成json文件 里面是密码修改配置文件中以下内容 并取消其注释
c.NotebookApp.allow_remote_access True
c.NotebookApp.ip * 
c.NotebookApp.password 填刚刚生成的密码 
c.NotebookApp.open_browser False
c.NotebookApp.port 8888 # 可自行指定一个端口, 访问时使用该端口
在vs code中使用jupyter 新建一个ipynb文件然后ctrl shift p选择一个使用本地或者远程的jupyter服务如果使用远程的服务 输入http://ip_addr:8888/即可 重新加载vs code窗口之后 会提示输入密码。 快捷键 代码缩进 tab 或 ctrl [运行cell ctrl enter运行cell并新建一个cell atl enter修改cell为markdown esc m修改cell为代码 esc y显示cell内的代码行数 esc l

其他参考链接

jupyter入门 — 参考链接Jupyter Notebook介绍、安装及使用教程jupyter notebook 可以做哪些事情
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/267800.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号