您的位置:首页 > 其它

Ubuntu中anaconda换源、在虚拟环境中安装jupyter notebook并安装tensorflow-gpu

2020-03-06 15:23 1776 查看

一、Anaconda换国内镜像源

还是之前说的,国外网下载安装东西太慢太不稳定了,不换源不行,所以anaconda最好也换一个源。
目前看来。好象是清华和中科大源对anaconda支持性较好,中科大的是我一直用的,很稳定也很好,清华源之前是停止更新了,但听说最近好像又更了(不知道真的假的)。

换源

anaconda换源很简单,直接执行两条命令就行
清华源

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.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

查看源

conda config --get channels

删除源

conda config --remove-key channels

此处参考博客 https://blog.csdn.net/kaige2111/article/details/90727476

二、创建并激活虚拟环境

前面已经写过,为了方便,这里再写一遍。

conda create -n 环境名字(自己写) python=3.6
source activate 环境名字

以后每次用都激活一下就行。退出虚拟环境用

source deactivate

三、安装TensorFlow_gpu

激活虚拟环境
用anaconda安装

conda install ‐‐channel https://conda.anaconda.org/anaconda tensorflow‐gpu=1.9.0

所安装的tensorflow-gpu版本号自己确定,这里的是1.9.0。如果你发现你要安装的版本这里面没有,比如tensorflow‐gpu=1.13.1这里面就没有,不妨直接
用pip安装

sudo pip install tensorflow‐gpu==1.13.1

一般我们会把keras也安装上

conda install keras或者
pip install keras

四、安装jupyter notebook

使用anaconda安装

conda install ipython
conda install jupyter

使用pip安装

sudo pip install ‐i https://pypi.tuna.tsinghua.edu.cn/simple jupyter

使用的时候直接在终端

jupyter notebook

就可以打开jupyter notebook 并使用。

  • 点赞
  • 收藏
  • 分享
  • 文章举报
gcampus 发布了10 篇原创文章 · 获赞 3 · 访问量 216 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: