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

深度学习环境配置 & 在云服务器上运行jupyter notebook

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

深度学习环境配置 & 在云服务器上运行jupyter notebook

目录

1.环境配置
sudo apt update   # 检查已安装的软件包是否有可更新的
sudo apt upgrade  # 更新软件包
sudo apt install python3.8  # 安装python
sudo apt-get install build-essential # 该包提供C/C++的编译环境
# 下载miniconda,用清华的镜像源
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
# 安装miniconda
bash Miniconda3-4.5.12-Linux-x86.sh
# 切换到默认的bash环境
bash
# 创建一个叫myenv的环境
conda create -n myenv python=3.8 -y
# 激活这个环境
conda activate myenv
pip install jupyter d2l torch torchvision -i http://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com
2.在云服务器上运行jupyter notebook

① 调用passwd()函数生成密匙

ipython    # 打开ipython
# 调用passwd()函数生成密匙,把密匙复制下来,后面会有用
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: 123456(我这里密码设置的是123456,后面远程登录jupyter用的也是这个密码)
Verify password: 123456
Out[2]:'argon2:$argon2id$v=19$m=10240,t=10,p=8$ID+dvCIs2olasYwa+Ox65g$4uo/eLF9itx6m6XNKnWYyw'

② 配置jupyter_notebook_config.py

jupyter notebook --generate-config

紧接着会显示配置文件的位置:

Writing default config to: /root/.jupyter/jupyter_notebook_config.py

编辑这个文件:vim /root/.jupyter/jupyter_notebook_config.py
在该文件中添加下面三句

c.NotebookApp.ip = '*'    # '*'表示可以接收任何客户端的访问
# 加入上面生成的密匙
c.NotebookApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$ID+dvCIs2olasYwa+Ox65g$4uo/eLF9itx6m6XNKnWYyw'
# 禁止在服务器端自动打开浏览器
c.NotebookApp.open_browser = False

③ 运行jupyter notebook

jupyter notebook --allow-root

④ 效果

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/529407.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

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

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