Linux环境下安装CPU版本的TensorFlow

官方教程https://tensorflow.google.cn/install/install_linux
1.首先要安装python 我用的3.6.4版本
2.然后安装Anaconda,这是一个Python的科学计算发行版,内置了很多功能强大的算法包,尤其是机器学习方面的。包括Scikit-learn、NumPy、SciPy等等这些,其中有一些是TensorFlow的依赖库。
www.continuum.io/downloads下载,基于python3.6还是2.7,可以选择
放在服务器上的目录/data/username/,
执行

bash Anacondaxxxxxxxx.sh

过程中有一些需要选择的,基本上一开始让你确认接受声明,然后需要配置路径,不然就会放在root下面。
最后有一个选择是不是要安装vscode,如果没特别需求都yes就好了。

3.安装TensorFlow

pip3 install --upgrade tensorflow

其实没有任何选项,如果是在线安装需要等大概30分钟,根据自己的网络情况而定
4.好像安装的有的问题,重新来试一下。

机器情况:
CPU
内存:128g
操作系统:Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) )
经过反复调试终于成功了,使用原生pip方式进行安装,主要内容如下
1.安装python3.6
2.安装pip3
3.安装python3 dev包
4.用pip3安装TensorFlow

pip3 install tensorflow

5.验证安装是否成功

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

这里可能弹出两个提示
FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
这个表示关于float这个类型,目前存在不统一的问题
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
这个表示 在某些指令集上没有经过编译,某些特性可能无法使用
得到一个正常的结果

b'Hello, TensorFlow!'

恭喜自己~~~

猜你喜欢

转载自blog.csdn.net/weixin_34008933/article/details/87212233