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

深度学习第一课:ubuntu20.04安装anaconda3-5.2.0-Linux-x86

Python 更新时间:发布时间: 百科书网 趣学号

官网下载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)

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

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号