引言: Tensorflow大名鼎鼎,这里不再赘述其为何物。这里讲描述在安装python包的时候碰到的“No matching distribution found for tensorflow”,其原因以及如何解决。

第一种解决方案

简单的安装tensorflow

这里安装的tensorflow的cpu版本,gpu版本可以自行搜索安装指南,或者参考如下指令:

pip3 install tensorflow     #cpu

这里使用的python 3.6.3版本。

pip3 install tensorflow-gpu

这里是gpu的版本。

window的环境

window 7.

问题描述:

pip3 install tensorflow

如此简单的指令,应该不会出错吧,结果得到如下错误信息:

Collecting tensorflow 
    Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow

为什么没有找到tensorflow呢?那我们自行找找看吧?

pip3 search tensorflow

具体的输出信息如下:

………………….. 
  tensorbase (0.3)                             - Minimalistic TensorFlow 
                                                 Framework 
  tensorbayes (0.3.0)                          - Deep Variational Inference in 
                                                 TensorFlow 
  tensorflow-tensorboard (0.4.0rc3)            - TensorBoard lets you watch 
                                                 Tensors Flow 
  tensorboard_logger (0.0.4)                   - Log TensorBoard events without 
                                                 Tensorflow 
  tensorboardX (0.8)                           - TensorBoardX lets you watch 
                                                 Tensors Flow without Tensorflow 
  tensorbuilder (0.3.6)                        - A light wrapper over TensorFlow 
                                                 that enables you to easily 
                                                 create complex deep neural 
                                                 networks using the Builder 
                                                 Pattern through a functional 
                                                 fluent immutable API 
  tensorflow-utils (0.1.0)                     - Classes and methods to make 
                                                 using TensorFlow easier 
  tensorflow-transform (0.4.0)                 - A library for data 
                                                 preprocessing with TensorFlow 
  tensorflow (1.5.0rc0)                        - TensorFlow helps the tensors 
                                                 flow 
  tensorflow_forward_ad (0.3.3)                - TensorFlow forward-mode 
                                                 automatic differentiation 
  tensorflow_hmm (0.4.1)                       - Tensorflow and numpy 
                                                 implementations of the HMM 
                                                 viterbi and forward/backward 
                                                 algorithms 
  tensorflow_nlp (0.0.1)                       - Deep Learning NLP Tasks 
                                                 implemented on Tensorflow 
  tensorflowonspark (1.1.0)                    - Deep learning with TensorFlow 
                                                 on Apache Spark clusters 
  tensorflowservingclient (0.5.1.post2)        - Prebuilt tensorflow serving 
                                                 client 
  tensorforce (0.3.4)                          - Reinforcement learning for 
                                                 TensorFlow 
  tensorfunk (0.0.0)                           - tensorflow model converter to 
                                                 create tensorflow-independent 
                                                 prediction functions. 
  tensorfuse (0.0.1)                           - Common interface for Theano, 
                                                 CGT, and TensorFlow 
  tensorgraph (3.5.8)                          - A high level tensorflow library 
                                                 for building deep learning 
                                                 models 
  tensorhive (0.1.1)                           - Lightweight computing resource 
                                                 management tool for executing 
                                                 distributed TensorFlow programs 
  tensorlm (0.3)                               - TensorFlow wrapper for deep 
                                                 neural text generation on 
                                                 character or word level with 
                                                 RNNs / LSTMs 
  TensorMol (0.1)                              - TensorFlow+Molecules = 
                                                 TensorMol 
  tensorpack (0.8.0)                           - Neural Network Toolbox on 
                                                 TensorFlow 
  tensorpy (1.1.0)                             - Easy Image Classification with 
                                                 TensorFlow! 
  tensorrec (0.1)                              - A TensorFlow recommendation 
                                                 algorithm and framework in 
                                                 Python. 
  tensorspark (1.0.6)                          - Tensorflow on Spark, a scalable 
                                                 system for high-performance 
                                                 machine learning 
  tensorvision (0.1.dev1)                      - A library to build and train 
                                                 neural networks in with 
                                                 TensorFlow for Computer Vision 
  TFANN (1.0.1)                                - A neural network module 
                                                 containing implementations of 
                                                 MLP, and CNN networks in 
                                                 TensorFlow. 
  TFBOYS (0.0.1)                               - TensorFlow BOYS 
  tfcf (0.0.0)                                 - A tensorflow-based recommender 
                                                 system. 
  tfcoreml (0.1.0)                             - Tensorflow to Core ML converter 
  tfdebugger (0.1.1)                           - TensorFlow Debugger 
  tfdeploy (0.4.2)                             - Deploy tensorflow graphs for 
                                                 fast evaluation and export to 
                                                 tensorflow-less environments 
                                                 running numpy. 
  tfgraph (0.2)                                - Python’s Tensorflow Graph 
                                                 Library 
  tfgraphviz (0.0.6)                           - A visualization tool to show a 
                                                 graph like TensorFlow and 
                                                 TensorBoard 
   …………………………………………

悲伤的我如此难以自抑,明明可以找到的,怎么却无法安装嗯?我需要自行好好找找明明是谁? :-)

问题分析

二话不说,直接上官网上查查看,虽然官网离我朝远隔万里,需要跋山涉水之后方可达到。翻过拿到看不见的墙之后,重要可以看到官方信息了。 
官方路标如下: https://www.tensorflow.org/install/install_windows 
其中所提安装步骤非常简洁,如此简洁的步骤,怎么可能出错? 于是重新梳理了一下,难道是Python或者pip3本身的问题吗?

check pip3

pip –version

发现其为最新版本:

pip 9.0.1 from d:\program files (x86)\python\lib\site-packages (python 3.6)

那Python呢? 官方文档中提到如下:

If one of the following versions of Python is not installed on your machine, install it now: 
   * Python 3.5.x 64-bit from python.org 
   * Python 3.6.x 64-bit from python.org

难道我安装的python是假python不成? 估计有可能吧,难道是64bit的问题?

检查python的版本

python -v

得到了python的完整信息:

..........................................
> D:\Program Files (x86)\python\lib\__pycache__\sysconfig.cpython-36.pyc matches D:\Program Files (x86)\python\lib\sysconfig.py
>  code object from 'D:\\Program Files (x86)\\python\\lib\\__pycache__\\sysconfig.cpython-36.pyc'
import 'sysconfig' # <_frozen_importlib_external.SourceFileLoader object at 0x006A1230>
> D:\Program Files (x86)\python\lib\__pycache__\_bootlocale.cpython-36.pyc matches D:\Program Files (x86)\python\lib\_bootlocale.py
> code object from 'D:\\Program Files (x86)\\python\\lib\\__pycache__\\_bootlocale.cpython-36.pyc'
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object at 0x007911D0>
> D:\Program Files (x86)\python\lib\encodings\__pycache__\gbk.cpython-36.pyc matches D:\Program Files (x86)\python\lib\encodings\gbk.py
> code object from 'D:\\Program Files (x86)\\python\\lib\\encodings\\__pycache__\\gbk.cpython-36.pyc'
import '_codecs_cn' # <class '_frozen_importlib.BuiltinImporter'>
import '_multibytecodec' # <class '_frozen_importlib.BuiltinImporter'>
import 'encodings.gbk' # <_frozen_importlib_external.SourceFileLoader object at 0x00791490>
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x004F73D0>
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>1234567891011121314151617

其中关于python的关键信息:

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32

“32bit” !!!  一口老血喷出,众里寻他千百度,蓦然回首bug正在这灯火阑珊处。原来是python版本的问题导致的。

修复问题

重新下载一个64bit的python版本,之后重新操作就可以了。

python -v

查看其中的关键信息:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32

确认是64位,没有问题。

然后直接安装tensorflow:

pip3 install tensorflow

安装过程如下:

C:\windows\system32>pip3 install tensorflow
Collecting tensorflow
  Downloading tensorflow-1.4.0-cp36-cp36m-win_amd64.whl (28.3MB)
    100% |████████████████████████████████| 28.3MB 39kB/s
Collecting enum34>=1.1.6 (from tensorflow)
  Downloading enum34-1.1.6-py3-none-any.whl
Requirement already satisfied: wheel>=0.26 in d:\program files (x86)\python\lib\site-packages (from tensorflow)
Collecting protobuf>=3.3.0 (from tensorflow)
  Downloading protobuf-3.5.1-py2.py3-none-any.whl (388kB)
    100% |████████████████████████████████| 389kB 593kB/s
Collecting tensorflow-tensorboard<0.5.0,>=0.4.0rc1 (from tensorflow)
  Downloading tensorflow_tensorboard-0.4.0rc3-py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 182kB/s
Requirement already satisfied: six>=1.10.0 in d:\program files (x86)\python\lib\site-packages (from tensorflow)
Collecting numpy>=1.12.1 (from tensorflow)
  Downloading numpy-1.13.3-cp36-none-win_amd64.whl (13.1MB)
    100% |████████████████████████████████| 13.1MB 81kB/s
Requirement already satisfied: setuptools in d:\program files (x86)\python\lib\site-packages (from protobuf>=3.3.0->tensorflow)
Collecting html5lib==0.9999999 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
  Downloading html5lib-0.9999999.tar.gz (889kB)
    100% |████████████████████████████████| 890kB 504kB/s
Collecting bleach==1.5.0 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
  Downloading bleach-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: werkzeug>=0.11.10 in d:\program files (x86)\python\lib\site-packages (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
Collecting markdown>=2.6.8 (from tensorflow-tensorboard<0.5.0,>=0.4.0rc1->tensorflow)
  Downloading Markdown-2.6.11-py2.py3-none-any.whl (78kB)
    100% |████████████████████████████████| 81kB 583kB/s
Building wheels for collected packages: html5lib
  Running setup.py bdist_wheel for html5lib ... done
  Stored in directory: C:\Users\chenjunfeng1\AppData\Local\pip\Cache\wheels\6f\85\6c\56b8e1292c6214c4eb73b9dda50f53e8e977bf65989373c962
Successfully built html5lib
Installing collected packages: enum34, protobuf, html5lib, numpy, bleach, markdown, tensorflow-tensorboard, tensorflow
Successfully installed bleach-1.5.0 enum34-1.1.6 html5lib-0.9999999 markdown-2.6.11 numpy-1.13.3 protobuf-3.5.1 tensorflow-1.4.0 tensorflow-tensorboard-0.4.0rc3123456789101112131415161718192021222324252627282930313233

然后大家就可以愉快地写代码了.

第二种解决方案

直接使用源路径下载:python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow source tree, and relaunch your python interpreter from there.

安装方法链接:
官网Download and install
极客学院中文教程

mac 系统OS X EI capitan时遇到一些问题:

1. 采用pip安装,进行到利用pip install tensorflow时报错:

Exception:
Traceback (most recent call last):File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in mainstatus = self.run(options, args)File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in runprefix=options.prefix_path,File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in installrequirement.uninstall(auto_confirm=True)File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstallpaths_to_remove.remove(auto_confirm)File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in removerenames(path, new_path)File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renamesshutil.move(old, new)File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in movecopytree(src, real_dst, symlinks=True)File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytreeraise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib/markers.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib', "[Errno 1] Operation not permitted: '/tmp/pip-CdODEu-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/_markerlib'")]

sudo方式同样无效,推测可能是OSX的安全策略导致修改系统目录权限失败?采用VirtualEnv凡是安装

2. 按照官网VirtualEnv方式完成安装后。运行Python,测试是否安装成功时:

 >>> import tensorflow as tf

会报错:

Error importing tensorflow.  Unless you are using bazel,
you should not try to import tensorflow from its source directory;
please exit the tensorflow source tree, and relaunch your python interpreter
from there.

解决方案参考@raingo 解释,需要先reinstall protobuf后再reinstall Tensorflow:

  - pip install -U protobuf==3.0.0b2- pip install --upgrade $TF_BINARY_URL

注意由于是VirtualEnv安装方式,需要先启动VirtualEnv。

Tensorflow安装问题: Could not find a version that satisfies the requirement tensorflow相关推荐

  1. Tensorflow安装问题: Could not find a version that satisfies the requirement tensorflow pip命令...

    引言: Tensorflow大名鼎鼎,这里不再赘述其为何物.这里讲描述在安装python包的时候碰到的"No matching distribution found for tensorfl ...

  2. Debug Mac M1/M2 tensorflow:Could not find a version that satisfies the requirement tensorflow

    报错信息 在M1芯片/M2芯片的Mac中安装tensorflow报错 ERROR: Could not find a version that satisfies the requirement te ...

  3. Python安装库Could not find a version that satisfies the requirement requests (from versions: none)

    解决 # 更新pip python -m pip install --upgrade pip # 安装 pip install 包名 -i http://pypi.douban.com/simple/ ...

  4. pip安装tensorflow报错:could not find a version that satisfies the requirement grpcio=1.8.6

    下图红色字体为错误提示: - ERROR: Could not find a version that satisfies the requirement grpcio>=1.8.6 (from ...

  5. pip安装tensorflow报错:could not find a version that satisfies the requirement grpcio>=1.8.6

    pip安装tensorflow报错:could not find a version that satisfies the requirement grpcio>=1.8.6 (venv) D: ...

  6. 【错误记录】Python 安装依赖库报错 ( ERROR: Could not find a version that satisfies the requirement elftools )

    文章目录 一.报错信息 二.解决方案 一.报错信息 报错信息 : ERROR: Could not find a version that satisfies the requirement elft ...

  7. python pip下载本地依赖包,并在离线环境中安装,并解决报错ERROR: Could not find a version that satisfies the requirement报错

    文章目录 步骤1:导出依赖 步骤2:离线下载依赖包 步骤3:进入新环境使用python安装依赖 整体思路如下: 首先根据项目需要导出依赖包,由于本地的python环境中其实安装了很多乱七八糟的包,这些 ...

  8. Python在使用pip安装某个库时报错 Could not find a version that satisfies the requirement numpy

    问题描述:Python中在使用pip的下述命令安装第三方库numpy pip install -U numpy -i http://mirrors.aliyun.com/pypi/simple 出现警 ...

  9. Mac用Pycharm安装mediapipe报错ERROR: Could not find a version that satisfies the requirement mediapipe

    问题 因为最近要用python做一个手部检测的项目,于是用找了个开源的程序跑了跑,发现安装mediapipe的时候会报错 ERROR: Could not find a version that sa ...

最新文章

  1. 微众银行AI团队开源联邦学习框架,并发布《联邦学习白皮书1.0》
  2. java初始化一个链表_Java 链表(LinkNode)的简单操作:初始化,遍历,插入,删除等...
  3. FuseSeg:用于自动驾驶领域的RGB和热成像数据融合网络
  4. 每天一个linux命令(9):touch命令
  5. 在性能测试时使用nmon进行监控服务器性能
  6. 19岁白帽子通过bug悬赏赚到一百万美元--转
  7. ASP.NET Core 中间件Diagnostics使用
  8. 微服务、Kubernetes和无服务器之后,即将发生的……
  9. .NET平台开源项目速览(9)软件序列号生成组件SoftwareProtector介绍与使用
  10. 自定义TBE算子入门,不妨从单算子开发开始
  11. 【Elasticsearch】index [index] blocked by: [TOO_MANY_REQUESTS/12/index read-only / allow delete (api)]
  12. 最大子段和_算法与数据结构_Python
  13. 重新分区_全面解析win10系统硬盘分区怎么调整大小
  14. 应用时间序列分析(王燕)学习笔记1
  15. AI洞观 | 一文读懂2018安博会四大趋势
  16. 软件测试登陆注册经典测试用例
  17. 网络电视(IPTV)系统解决方案
  18. ModelCheckpoint详解
  19. 利用Excel进行相关、回归分析
  20. 力扣解法汇总1765-地图中的最高点

热门文章

  1. php功能代码下载,PHP实现下载功能的代码
  2. 为什么在python中整数的值没有限制_为什么在Python中整数是不可变的?
  3. python保存mat文件_python读取文件——python读取和保存mat文件
  4. Vue -- 如何在 span 标签上实现一个点击事件
  5. @ApiImplicitParam注解的dataType、paramType两个属性的区别?
  6. Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9
  7. dom4j添加节点的父节点_HTML DOM节点介绍
  8. Python 变量赋值
  9. 苹果本周四将发布 OS X Yosemite 公开测试版
  10. Git本地版本控制备忘