深度学习环境配置 & 在云服务器上运行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

④ 效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

漂流の少年

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

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

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

打赏作者

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

抵扣说明:

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

余额充值