随笔 - 27  文章 - 16  评论 - 1  阅读 - 36828

Ubuntu下安装Anaconda和tensorflow

官方指南:https://github.com/tensorflow/tensorflow/blob/master/tensorflow/docs_src/install/install_linux.md#InstallingAnaconda
https://github.com/jtoy/awesome-tensorflow
1.在清华大学 TUNA 镜像源选择对应的操作系统与所需的Python版本下载Anaconda安装包。  
 bash Anaconda3-5.0.1-Linux-x86_64.sh

在安装的过程中,会询问安装路径,按回车即可。之后会询问是否将Anaconda安装路径加入到环境变量(.bashrc)中,输入yes,这样以后在终端中输入python即可直接进入Anaconda的Python版本(如果你的系统中之前安装过Python,自行选择yes or no)。安装成功后,会有当前用户根目录下生成一个anaconda3的文件夹,里面就是安装好的内容

查询安装信息 $ conda info

查询当前已经安装的库 $conda list

安装库(***代表库名称)$conda install ***

更新库$conda update ***

2. 添加清华大学 TUNA提供的Anaconda仓库镜像

$ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

$ conda config --set show_channel_urls yes

之后会自动在用户根目录生成“.condarc”文件,Ubuntu环境下路径为~/.condarc,Windows环境下路径为C:\用户\your_user_name\.condarc

3.安装

创建环境:$conda create -n tensorflow 
激活:$source activate tensorflow
搜索当前可用的tensorflow版本:$ anaconda search -t conda tensorflow

$anaconda show anaconda/tensorflow

$conda install --channel https://conda.anaconda.org/anaconda tensorflow

   或者conda install -c anaconda tensorflow

测试:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

关闭: $source deactivate tensorflow

注:若出现类似The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations这样的warning,可以通过在终端中输入export TF_CPP_MIN_LOG_LEVEL=2解决

posted on   medsci  阅读(3740)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示