您当前的位置: 首页 >  linux

Better Bench

暂无认证

  • 2浏览

    0关注

    695博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【Deepin 20系统】Linux系统利用anaconda同时安装Tensorflow1.x和tensorflow2.x

Better Bench 发布时间:2020-12-16 16:20:25 ,浏览量:2

引言

本人首先利用anaconda安装了tensorflow2.3,但是需要用到tensorflow1的版本。需要执行以下步骤。

1 安装tensorflow2.x

首先下载anaconda 参考本人博客【Deepin 20系统】Linux系统安装Anaconda和Tensorflow-gpu2.3

2 安装tensorflow1.x 2.1 更换镜像(也可跳过)

1、在创建虚拟环境的过程中,会通过Internet下载相关的库,可能在国内有些慢。最好的方式是设置国内的镜像。可以使用下面的命令查看Anaconda当前的镜像。

conda config --show channels

2、如果在此之前设置了其他的镜像,可以使用下面的命令删除这些镜像。

conda config --remove channels 镜像名

如果通过以上命令查看镜像是defaults,删除命令是

conda config --remove channels defaluts

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/

#从channel中安装包时显示channel的url,这样就可以知道包的安装来源了。 conda config --set show_channel_urls yes

4、设置完镜像后,使用conda config --show channels命令,会看到新添加的镜像。

2.2 创建虚拟环境

1、同上创建一个TensorFlow1.x版本的环境,注意1.x版本最高只能对应Python3.6

conda create -n tf1 python=3.6 conda activate tf1

2、安装tensorflow-gpu 1.15版本

pip install tensorflow-gpu==1.15

如果报错pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out.

因为超过设定的timeout,以下指令二选一. 自定义timeout,并指定清华镜像源

pip --default-timeout=100 install tensorflow-gpu==1.15 -i https://pypi.tuna.tsinghua.edu.cn/simple

指定豆瓣镜像源

pip --default-timeout=100 install tensorflow-gpu==1.15 -i https://pypi.douban.com/simple

在这里插入图片描述

3 anaconda常用命令

1、切换回base虚拟环境命令

conda deactivate

2、 进入自己创建的虚拟环境

conda activate tf1

关注
打赏
1665674626
查看更多评论
立即登录/注册

微信扫码登录

0.0405s