Linux下安裝任意版本的tensorflow命令

hearthougan發表於2017-07-05

終端或命令列下輸入:

sudo pip install \
  -i https://pypi.tuna.tsinghua.edu.cn/simple/ \
  https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp27-none-linux_x86_64.whl

上述只是一個樣例,安裝任意版本的tensorflow,只需修改相應的版本號,比如,我現在想下載tensorflow-1.0.0版本的: 

sudo pip install \
  -i https://pypi.tuna.tsinghua.edu.cn/simple/ \
  https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/gpu/tensorflow_gpu-1.0.0-cp27-none-linux_x86_64.whl

如下:

測試是否安裝成功:

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


相關文章