环境配置

pip

配置文件:

1
~/.pip/pip.conf

更换国内镜像源:

1
2
3
4
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

TensorFlow-gpu

为避免出错 pytorch和tensorflow都使用conda install安装

  1. anconda
    conda create -n tf python=3.6

  2. cuda deb

  3. pytorch 官网 自动安装cudnn

    https://pytorch.org/get-started/locally/

    conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch
    测试:

    1
    2
    import torch
    torch.cuda.is_available()
  4. TensorFlow gpu
    conda install tensorflow-gpu
    测试:

    import tensorflow as tf

    tf.test.is_gpu_available()