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

前端之家收集整理的这篇文章主要介绍了Ubuntu 14.04-64bit安装pip遇到的问题及tensorflow的安装前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

问题

欲使用命令: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
>>>
原文链接:https://www.f2er.com/ubuntu/355545.html

猜你在找的Ubuntu相关文章