- A+
所属分类:未分类
1.安装Anaconda
1.1下载Anaconda
官网下载太慢,所有最好通过清华的镜像下载
我下载的是 Anaconda3-5.2.0-Linux-x86_64.sh
1.2安装Anaconda
#下载 wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-5.2.0-Linux-x86_64.sh #安装 #chmod +x Anaconda3-5.2.0-Linux-x86_64.sh #./Anaconda3-5.0.1-Linux-x86_64.sh
之后根据提示安装就可以了。
其中可能少些依赖,如下:
报错:./Anaconda3-5.2.0-Linux-x86_64.sh:行350: bunzip2: 未找到命令 解决:yum install -y bzip2 注:若没有将地址添加到PATH中可用:
安装过程中第一步按enter继续,第二步输入yes,第三步填写安装路径,如下:
Please, press ENTER to continue >>> ---------------按enter键 =================================== Anaconda End User License Agreement =================================== Copyright 2015, Anaconda, Inc. All rights reserved under the 3-clause BSD License: ................................ Do you accept the license terms? [yes|no] [no] >>> yes Anaconda3 will now be installed into this location: /root/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/root/anaconda3] >>> /qiku/anaconda3 或者默认回车安装到root/anaconda3
然后就开始自动安装了,等待结果吧。
如下,说明安装成功了:
完毕! export PATH=/qiku/anaconda3/bin:$PATH Updating VSCode Config ... Installing Extensions ... Found 'ms-python.anaconda-extension-pack' in the marketplace. Installing... Extension 'ms-python.anaconda-extension-pack' v1.0.0 was successfully installed! VSCode successfully installed in /usr/share/code !
然后/etc/profile下配置环境变量,如下:
export PATH=/qiku/anaconda3/bin:$PATH
然后source /etc/profile
1.3测试Anaconda
[root@localhost ]# conda --version conda 4.5.4
2安装Tensorflow
2.1创建专门的运行环境
[root@localhost]# conda create -n tensorflow python=3.6 anaconda
2.2列出所有的环境
[root@localhost]# conda info --envs # conda environments: # base * /qiku/anaconda3 tensorflow /qiku/anaconda3/envs/tensorflow
2.3删除创建的环境
root@localhost]# conda remove -n tensorflow --all
2.3启动Tensorflow运行环境
source activate tensorflow #关闭运行环境 #source deactivate tensorflow
2.3安装CPU版Tensorflow
pip install tensorflow
如果安装失败(你懂得),就使用清华 TUNA的仓库镜像库安装
#添加清华大学 TUNA提供的Anaconda仓库镜像 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes conda install numpy #测试是否添加成功 #搜索可用版本 anaconda search -t conda tensorflow #选择一个较新的CPU或GPU版本,如jjh_cio_testing/tensorflow的1.0.1版本,输入如下命令查询安装命令 anaconda show jjh_cio_testing/tensorflow #使用最后一行的提示命令进行安装 conda install --channel https://conda.anaconda.org/jjh_cio_testing tensorflow #conda会自动检测安装此版本的Tensorflow所依赖的库,如果你的Anaconda缺少这些依赖库,会提示你安装。
2.4测试
import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫