安装python:
-
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
-
tar xvf Python-3.6.5.tgz
-
cd Python-3.6.5
-
./configure --prefix=/usr/local/lib/python3.6
-
make -j8
-
sudo make install -j8
软连接:
-
sudo ln -s /usr/local/lib/python3.6/bin/python3.6 /usr/bin/python3.6
-
sudo ln -s /usr/local/lib/python3.6/bin/pip3.6 /usr/bin/pip3.6
安装TensorFlow:
-
wget https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl
-
pip3 install --upgrade tensorflow-1.7.0-cp36-cp36m-linux_x86_64.whl
测试TensorFlow安装是否成功:
-
# Python
-
import tensorflow as tf
-
hello = tf.constant('Hello, TensorFlow!')
-
sess = tf.Session()
-
print(sess.run(hello))