深度学习第一课:ubuntu20.04安装anaconda3-5.2.0-Linux-x86_64.sh pytorch1.7.1 jupyter和opencv(Typora复制粘贴)

官网下载Anaconda3-5.2.0-Linux-x86_64.sh到本地(Xshell直接拖动)

bash Anaconda3-5.2.0-Linux-x86_64.sh (yes...)

ubuntu换源(先备份)(可能用sudo)

cp /etc/apt/sources.list /etc/apt/sources.list.bak

chmod 777 /etc/apt/sources.list

vim /etc/apt/sources.list

#添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse

更新源(sudo)

apt-get update

更新软件

apt-get upgrade

创建conda环境

查看python版本

python

conda create -n pt171 python=3.6.5

查看环境

conda info -e

进入环境

source activate pt171

安装pytorch(GPU 从官网)

首先 pip install numpy(听说不装会报错?迷信一波)

conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch

查看安装

conda list

测试是否安装成功

python 
import torch 
torch.cuda.is_available() 

另:测试cuda是否安装成功

nvcc -V

安装jupyter(要在pytorch环境中)

pip install jupyter

生成notebook配置文件

jupyter notebook --generate-config

生成密码(jupyter_notebook_config.json中生成hash码)

jupyter notebook password

vim /home/yjc/.jupyter/jupyter_notebook_config.json

修改配置文件

vim /home/yjc/.jupyter/jupyter_notebook_config.py

c.NotebookApp.ip='*'
c.NotebookApp.password = u'从json复制粘贴'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.allow_remote_access = True

输入jupyter notebook启动

页面输入ip:端口号(8888)

安装opencv(在环境中)

pip install opencv-python

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值