1.安装Anaconda3
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-4.2.0-Linux-x86_64.sh
bash Anaconda3-4.2.0-Linux-x86_64.sh
接着就要激活环境,export PATH=/root/anaconda3/bin:$PATH,让环境变量生效
2.安装tensorflow
conda create -n tensorflow3.5 pip python=3.5
source activate tensorflow3.5
pip install --ignore-installed --upgrade https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.7.0-cp35-cp35m-linux_x86_64.whl
退出环境是
source deactivate
安装的时候遇到问题1:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-g3ii_1q2/futures/
解决方法:
pip install --upgrade pip
重新运行上面的pip install --igo…
成功安装
安装的时候遇到问题2:
AttributeError: module ‘numpy’ has no attribute ‘equal’
解决方法:
pip install -U numpy
pip show numpy
安装出现问题3
FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecate
解决方法:
numpy版本过高,给numpy降级,问题解决
pip install numpy==1.16.0
参照https://blog.csdn.net/bigdream123/article/details/99467316
3.测试
自己会装好,然后测试一下
//输入python进入,然后输入一下代码
import tensorflow as tf
hello=tf.constant('hello')
sess=tf.Session()
print(sess.run(hello))
遇见问题:
I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
解决方案
1.掩耳盗铃式
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
参照https://blog.csdn.net/feng98ren/article/details/84874326
2.彻底解决
1.13.1版本支持AVX2
pip install --ignore-installed --upgrade https://github.com/lakshayg/tensorflow-build-archived/releases/download/tf1.13.1-ubuntu16.04-py3/tensorflow-1.13.1-cp35-cp35m-linux_x86_64.whl
将tensorflow导入到pycharm
https://blog.csdn.net/qq_36982160/article/details/79603927