Linux安装Anaconda3并创建虚拟环境来安装tensorflow-gpu和tensorflow-federated

安装Anaconda

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.02-Linux-x86_64.sh

bash Anaconda3-2020.02-Linux-x86_64.sh 

创建并激活虚拟环境(name:tff)

conda create -n tff
conda activate tff

安装tensorflow-gpu

# conda activate tff
conda install tensorflow-gpu==2.1.0

添加清华源

mk ~/.pip
touch ~/.pip/pip.conf

.pip/pip.conf中添加清华源

[global]
timeout=6000
index-url=https://pypi.tuna.tsinghua.edu.cn/simple

我们也给conda添加清华源吧

# conda activate tff
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/

安装tensorflow-federated

由于conda里面没有tensorflow-federated,所以只能pip安装

# conda activate tff
pip install tensorflow-federated

测试

进入python shell

# conda activate tff
# python
import tensorflow as tf
import tensorflow_federated as tff
print(tf.version.VERSION) # '2.1.0'
print(tff.version.__version__) # '0.13.1'

你可能感兴趣的:(大数据,联邦学习)