您的位置:首页 > 其它

Ubuntu 14.04-64bit安装pip遇到的问题及tensorflow的安装

2016-12-08 18:52 441 查看

问题

欲使用命令:pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensor 
flow-0.5.0-cp27-none-linux_x86_64.whl安装tensorflow时,在安装pip的步骤中,使用命令:

sudo apt-get install python-pip安装pip出现如下错误:

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.googleapis.com/tensorflow/linux/cpu/ 
tensorflow-0.5.0-cp27-none-linux_x86_64.whl即可安装成功


测试代码及结果

打开一个 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
>>>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: