Linux服务器安装conda+pytorch+tensorflow

安装miniconda

  • 新建文件夹
    mkdir download
  • 进入目录
    cd download/
  • 下载miniconda安装包
	wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh
  • 使用安装包
    sh Miniconda3-latest-Linux-x86_64.sh
    (连续输入yes)
    如果出现
    在这里插入图片描述
    添加环境变量
    export PATH=~/miniconda3/bin:$PATH
    source ~/.bashrc
  • 添加源
	conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
	# for legacy win-64
	conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
	conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
	conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
	conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
	conda config --add channels 
	conda config --set show_channel_urls yes

–清除源

conda config --remove-key channels

设置搜索时显示通道地址

conda config --set show_channel_urls yes

  • 创建名为py36的虚拟环境
    conda create -n py36 python=3.6
    conda activate py36 (加入 ~/.bashrc 默认激活该环境)
    在这里插入图片描述

查看CUDA CUDNN 版本

cat /usr/local/cuda/version.txt
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
在这里插入图片描述
版本为:
cuda 9.0.176
cudnn 7.0.5

确定合适的TensorFlow和PyTorch版本

  • TensorFlow
    https://tensorflow.google.cn/install/source#linux
    在这里插入图片描述
    例如我的环境可以安装tf 1.11.0 (GPU)
conda install tensorflow-gpu==1.11.0
  • PyTorch
    https://pytorch.org/
    https://pytorch.org/get-started/previous-versions/
    在这里插入图片描述
    在这里插入图片描述
    例如我的环境可以安装 pytorch 1.1.0 (GPU)
    conda install pytorch==1.1.0 torchvision==0.3.0
    # 不用加 -c 为用国内源
    

查看版本号检查是否安装成功

  • TensorFlow
    在这里插入图片描述
  • PyTorch
    在这里插入图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

zb12138

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

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

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

打赏作者

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

抵扣说明:

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

余额充值