問(wèn)題
欲使用命令:pip install https://storage./tensorflow/linux/cpu/tensor
flow-0.5.0-cp27-none-linux_x86_64.whl安裝tensorflow時(shí),在安裝pip的步驟中,使用命令:
sudo apt-get install python-pip安裝pip出現(xiàn)如下錯(cuò)誤:
The following packages have unmet dependencies:
python-pip : Depends: python-pip-whl (= 1.5.4-1ubuntu3) but it is not going to be installed
Recommends: python-dev-all (>= 2.6) but it is not installable
E: Unable to correct problems, you have held broken packages.
解決方法
1、 sudo apt-get update
2、sudo apt-get upgrade
3、sudo apt-get install python-setuptools python-dev build-essential
4、sudo easy_install pip
5、最后使用命令:pip install https://storage./tensorflow/linux/cpu/
tensorflow-0.5.0-cp27-none-linux_x86_64.whl即可安裝成功
測(cè)試代碼及結(jié)果
打開(kāi)一個(gè) python 終端:
$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print sess.run(a+b)
42
>>>
|