在Ubuntu 14.04上安装TensorFlow

12

我正在尝试按照这些说明进行操作

sudo apt-get install python-pip python-dev

sudo pip install tensorflow

user@user-VirtualBox:~$ sudo pip install tensorflow
Downloading/unpacking tensorflow
  Could not find any downloads that satisfy the requirement tensorflow
Cleaning up...
No distributions at all found for tensorflow
Storing debug log for failure in /home/user/.pip/pip.log

以下是pip日志:

user@user-VirtualBox:~$ cat /home/user/.pip/pip.log
------------------------------------------------------------
/usr/bin/pip run on Thu Jan 26 17:25:02 2017
Downloading/unpacking tensorflow
  Getting page https://pypi.python.org/simple/tensorflow/
  URLs to search for versions for tensorflow:
  * https://pypi.python.org/simple/tensorflow/
  Analyzing links from page https://pypi.python.org/simple/tensorflow/
    Skipping https://pypi.python.org/packages/00/16/c8ba385fc6511ca362f32326cd1d6a99bbbabbc8341607ff70c290e0be7b/tensorflow-0.12.1-cp34-cp34m-manylinux1_x86_64.whl#md5=981c0a406eb9865423b11c03b489040d (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/01/c5/adefd2d5c83e6d8b4a8efa5dd00e44dc05de317b744fb58aef6d8366ce2b/tensorflow-0.12.0-cp27-cp27mu-manylinux1_x86_64.whl#md5=ebcd1b32ccf2279bfa688542cbdad5fb (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/03/51/b68d9d6481d16fd709290030ae8a8a13212587bc87fae718e521bdafa723/tensorflow-0.12.0rc1-cp27-cp27mu-manylinux1_x86_64.whl#md5=9329984aa4f6388f5ec2a170e4ae968e (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/11/c9/2ec86336a8a401a57fabed5b10ee7f0493fc334b33e9672766b1149dd923/tensorflow-0.12.0-cp35-cp35m-win_amd64.whl#md5=d515d2ae08ae25fc8bf81e3374448146 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/16/6e/fa1f09a32d3ba5bf6a2b79c6ec16a43c91e3a79e0035ab3eb52ecad22e0d/tensorflow-0.12.1-cp35-cp35m-macosx_10_11_x86_64.whl#md5=faf5d055cdaecd75e5f0b37a04676102 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/25/23/24681ce011cd33ea5b22b8efd0f28a3f1294085c6ca6f70cc3abd62bf75d/tensorflow-0.12.0rc1-cp35-cp35m-macosx_10_11_x86_64.whl#md5=6c964e9575ed88892b94195a05aa8e65 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/25/c4/162ea5fa9e012f5a5e125105f6b290e56f9fd617a7aadd57d9a26bb386ca/tensorflow-0.12.0rc1-cp34-cp34m-manylinux1_x86_64.whl#md5=4e77b31ae9fc0e36489875ce0f72b267 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/33/4b/20e517870effa573405d30dafc22f330f24c0a8928659b4ad5a44b9a9af2/tensorflow-0.12.0rc0-cp35-cp35m-macosx_10_11_x86_64.whl#md5=8d1376a68f768efa57b1344fc2df0472 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/33/ab/3a62133d6c9f6281959f3ca96ad2a796fb4fed8d642c4f33d9fd97d8bf6f/tensorflow-0.12.0rc1-cp27-cp27m-macosx_10_11_x86_64.whl#md5=491802c10e992905d7e80108b9b16920 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/34/53/0e10581ad88bca25e5005874e46130b12efbd5eb1bda493dbf9b1648cbe2/tensorflow-0.12.1-cp27-cp27m-macosx_10_11_x86_64.whl#md5=d3f44a0596a623458c42c2a694abb0af (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/4a/c3/1ad85e5c4fde90b2e9a5101283d97dd41ba6c24f44a1c3a8495ef7098bb5/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl#md5=dad56a38acf7ca501b1bfeeef53f3710 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/64/9c/72aff7713c507f7e6c15df011e0ed18ac85e5bfa16c3763d8cba44585d79/tensorflow-0.12.0rc0-cp34-cp34m-manylinux1_x86_64.whl#md5=93431c5cd8a019d08a72e6c0a75eaaf4 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/64/a3/0054a3329579de44d557f491adbcaf8127809a7992bc46af80f0a589e29b/tensorflow-0.12.1-cp35-cp35m-win_amd64.whl#md5=d657836c76a5cd3c6d5560034bd7ade6 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/66/47/d6bb91a11684733ad565b891d561097ef10f8cb7bae87e5ad692207024e3/tensorflow-0.12.0rc1-cp35-cp35m-manylinux1_x86_64.whl#md5=2351fe799a0869487699537ab0e33019 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/67/06/15153c48b2281bc59f8a70f2ae681723ece29ebc0015883117fb28abaf68/tensorflow-0.12.0rc0-cp35-cp35m-manylinux1_x86_64.whl#md5=ebc1ee880633a60e5256e745a27d4058 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/7e/c6/837f4e249aae5c86a632eaaa9779e601eca1487772f8ad75c347bf9e813f/tensorflow-0.12.1-cp27-cp27mu-manylinux1_x86_64.whl#md5=c98fd26b79a97cc490c942bbafed5462 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/7e/ea/e42e47ddb39d2043a06dc93b5aec042bae8571be52ea664aa03246a83c32/tensorflow-0.12.0-cp35-cp35m-macosx_10_11_x86_64.whl#md5=f8b165ae638eb169220ccbf02658475b (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/90/cf/1d1e12f9f39b6a0ed1c49792ef5ce7615dddc2ce7287fc83ede0dddb9b3c/tensorflow-0.12.0rc0-cp27-cp27m-macosx_10_11_x86_64.whl#md5=7be7b7488a6be83546758a40d5442901 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/91/7c/98b25b74241194d4312a7e230c85a77b254224191dbf17b484811f8a9f61/tensorflow-0.12.1-cp36-cp36m-macosx_10_11_x86_64.whl#md5=3b2f5f08fe61471ea973a4bdbdfbae43 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/96/d6/096f6624a8a48d41801eb23863d35a37532baf32f6d3aa2e03c96f66e6ab/tensorflow-0.12.0-cp34-cp34m-manylinux1_x86_64.whl#md5=a6a0af9cf2a5fc33053f638b05cb3940 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/9e/7c/f50ca985e43cff46a6d92abb088e8328b9be13335dc44af291ac1ed11862/tensorflow-0.12.0-cp35-cp35m-manylinux1_x86_64.whl#md5=2c07109df1a9865a7a44b6fe08756e8d (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/a7/86/cb47c1213779939583091fc97e0950c323d655186824cdbc0f657f42930c/tensorflow-0.12.0-cp27-cp27m-macosx_10_11_x86_64.whl#md5=fc429a5b5b74517e08216ee8b1d04e59 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/b2/da/9132af1e2ef3771b63619072a6d82800bd60acbf2c8bea8e4f26514c768a/tensorflow-0.12.0rc1-cp35-cp35m-win_amd64.whl#md5=69b6c2e9440fd2d7a2d86249933fcde0 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/e5/5c/56e6522fdcd6f8739dcbc4de62e8b0040e141785bb42e5b53a83b0ba3e58/tensorflow-0.12.1-cp35-cp35m-manylinux1_x86_64.whl#md5=c6e3ba8579754f37d37be26e863f9d95 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/e7/73/85ff235957f2652f78a2cd7f0a045d3f983302991cb7af2fddedf27d56fe/tensorflow-0.12.1-cp33-cp33m-manylinux1_x86_64.whl#md5=d77e48ef3b45e543ca165db93f27e0ff (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/e9/a5/45b172f20e2fabd19c7f18a44570fc82acc4c628ec9bc4b313de39c4fe37/tensorflow-0.12.1-cp36-cp36m-manylinux1_x86_64.whl#md5=def6ab7dc3930f34f3000caef34f4333 (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/f6/2a/e5bb6320a3fc2886f2677ffa0d4396eefb5914cfc19db94e672c650f0700/tensorflow-0.12.0rc0-cp27-cp27mu-manylinux1_x86_64.whl#md5=00a6b89122d86fd527558a2740fd6f8f (from https://pypi.python.org/simple/tensorflow/) because it is not compatible with this Python
  Could not find any downloads that satisfy the requirement tensorflow
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
No distributions at all found for tensorflow
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1178, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/usr/lib/python2.7/dist-packages/pip/index.py", line 277, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for tensorflow

所以我理解需要其他的Python版本?我的Python版本是python --version Python 2.7.6。

另外我尝试了这个方法(它有效):

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

sudo pip install --upgrade $TF_BINARY_URL

但我想知道为什么通过sudo pip install tensorflow安装没有起作用?


你的pip版本是多少? - fedorqui
@fedorqui pip --version 来自 /usr/lib/python2.7/dist-packages 的 pip 1.5.4 (python 2.7) - mrgloom
2
好的。安装指南中提到:“请注意,在Linux上运行以下命令需要pip版本8.1或更高版本。”我刚刚按照虚拟环境安装步骤进行了操作,一切都很顺利。 - fedorqui
2
那是相当老的pip版本,尝试升级它。 pip install --upgrade pip。顺便说一句,Ubuntu 14.04非常老,你需要在VirtualBox中使用这个特定版本吗?否则考虑将Ubuntu升级到最新的LTS版本(16.04)。 - user2261062
我在Ubuntu 14.04上遇到了同样的问题。pip升级对我没有用(仍然是旧版本)sudo pip install --upgrade pip 从https://pypi.python.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl#md5=297dbd16ef53bcef0447d245815f5144下载/解压pip 下载pip-9.0.1-py2.py3-none-any.whl (1.3MB): 已下载1.3MB 安装收集的软件包:pip 找到现有的安装:pip 1.5.4 不卸载由操作系统拥有的/usr/lib/python2.7/dist-packages中的pip 成功安装pip 清理... - timguy
1个回答

26

通常是因为您使用的pip版本低于8.1,请运行

pip install --upgrade pip
pip install --upgrade tensorflow

如果上述代码无效,请尝试通过发出以下格式的命令在活动虚拟环境中安装TensorFlow:

 (tensorflow)$ pip install --upgrade TF_PYTHON_URL   # Python 2.7
 (tensorflow)$ pip3 install --upgrade TF_PYTHON_URL  # Python 3.N 

TF_PYTHON_URL是指TensorFlow Python软件包的URL地址。TF_PYTHON_URL的适当值取决于操作系统、Python版本和GPU支持情况。在此处找到适合您系统的TF_PYTHON_URL的值。例如,如果您想要为Linux系统、Python 2.7版本和仅CPU支持安装TensorFlow,则需要在活动虚拟环境中使用以下命令进行安装:

(tensorflow)$ pip3 install --upgrade \
 https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp34-cp34m-linux_x86_64.whl

更多细节请参考TensorFlow官方网站


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接