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

这篇博客介绍了如何在Linux系统中通过Anaconda3安装TensorFlow GPU版,并创建名为'tff'的虚拟环境。接着,文章详细说明了如何添加清华源,然后使用pip在环境中安装TensorFlow Federated。最后,作者进行了测试以确保安装成功。
摘要由CSDN通过智能技术生成

安装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

添加清华源

mkdir ~/.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'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值