Ubuntu TensorFlow1与TensorFlow2共存配置

Ubuntu TensorFlow1与TensorFlow2共存配置

1.查看Anaconda中的所有虚拟环境

使用命令

conda info --envs

返回结果

# conda environments:
#
base                     /home/yc/anaconda3
tensorflow            *  /home/yc/anaconda3/envs/tensorflow
2.创建和移除Anaconda虚拟环境

创建命令

conda create --name tensorflow python=3.6.10

删除之前设置镜像的命令

conda config --remove channels 镜像名

显示已经设置的镜像名

conda config --show channels

添加新的镜像的命令(清华源)

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

添加新的镜像的命令(北京外国语大学开源镜像站)-------最近清华源速度慢,建议用北外的镜像

conda config --add channels 
https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/

conda config --add channels 
https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/

conda config --set show_channel_urls yes

激活虚拟环境

conda activate tensorflow

关闭虚拟环境

conda deactivate

移除虚拟环境

conda remove -n tensorflow --all
3.查看自己所安装的CUDA版本

下面两个指令都可以(前提是添加了环境变量)

nvcc -V 
nvcc --version

返回结果

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
4.安装TensorFlow 1.x

在创建环境之后输入命令(最好使用conda)

conda install tensorflow-gpu==1.14.0

5.安装和移除TensorFlow 2.x

安装不支持GPU的Tensorflow

pip install tensorflow 

安装支持GPU的Tensorflow

pip install tensorflow-gpu 

升级Tensorflow

pip install   --upgrade tensorflow    
pip install   --upgrade tensorflow-gpu   

移除Tensorflow

pip uninstall tensorflow
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值