linux安装tensoflow

1.安装Anaconda

第一条:wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
第二条:bash Anaconda3-2020.11-Linux-x86_64.sh
第三条:source ~/.bashrc

2. 创建虚拟环境

然后创建个虚拟环境(进入虚拟环境),
conda env list 或 conda info -e 查看当前存在哪些虚拟环境
在这里插入图片描述
创建新的环境:conda create -n env_flow python=3.7
在这里插入图片描述
安装成功
进入虚拟环境: conda activate env_flow

其他的一些命令:
删除虚拟环境:
使用命令conda remove -n your_env_name(虚拟环境名称) --all, 即可删除。

删除环境中的某个包。
使用命令conda remove --name your_env_name package_name 即可

3. 换源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

vim ~/.condarc
查看conda源
在这里插入图片描述

4. 安装tensorflow

根据官网的命令:

pip install tensorflow

测试tensorflow是否支持GPU版本:

import tensorflow as tf
tf.test.is_gpu_available()
在这里插入图片描述
或者tf.config.list_physical_devices('GPU')
在这里插入图片描述

posted @ 2022-03-14 22:01  为红颜  阅读(274)  评论(0编辑  收藏  举报