1.安装Anaconda
下载 Anaconda2-5.0.1-Linux-x86_64.sh 文件
执行下面命令:
bash Anaconda2-5.0.1-Linux-x86_64.sh
遇到选yes或no的都选yes
具体参考此博客:https://blog.csdn.net/woainishifu/article/details/74978647
2.安装Tensorflow
调用以下命令创建名为 tensorflow 的 conda 环境,以运行某个版本的 Python:
conda create -n tensorflow pip python=2.7
激活tensorflow环境:
source activate tensorflow安装python2.7 仅支持CPU的tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp27-none-linux_x86_64.whl3.测试
输入以下几行代码:
python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
输出结果为Hello, TensorFlow! 说明安装成功
4.退出tensorflow环境:
source deactivate
5.问题
1)在ipython和jupyter notebook中,import tensorflow时,都显示找不到模块
目前的解决方案:在tensorflow环境下再安装一遍这两个文件
我的疑惑:如何不通过载安装的方式解决这个问题,比如通过改什么路径的方式
问题原因:网速太慢,下载失败
解决方案:用清华大学开元软件镜像站
在tensorflow环境下,运行以下命令,即可成功安装jupyter:
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