我正在尝试使用pip安装TensorFlow:

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

我做错了什么?到目前为止,我使用Python和pip没有任何问题。


当前回答

我也有同样的问题。在卸载32位版本的python并重新安装64位版本后,我尝试重新安装TensorFlow,它工作了。

TensorFlow指南链接:https://www.tensorflow.org/install/install_windows

其他回答

摘自tensorflow网站 https://www.tensorflow.org/install/install_windows

Installing with native pip If the following version of Python is not installed on your machine, install it now: Python 3.5.x from python.org TensorFlow only supports version 3.5.x of Python on Windows. Note that Python 3.5.x comes with the pip3 package manager, which is the program you'll use to install TensorFlow. To install TensorFlow, start a terminal. Then issue the appropriate pip3 install command in that terminal. To install the CPU-only version of TensorFlow, enter the following command:

C:\> pip3 install --upgrade tensorflow
To install the GPU version of TensorFlow, enter the following command:

C:\> pip3 install --upgrade tensorflow-gpu

注意:这个答案是针对Cygwin用户的

留下这个答案是因为这里的其他方法都不适合我的用例(使用*nix-on-Windows终端环境在virtualenv上安装tensorflow, cygwin (http://www.cygwin.com/))(至少在答案页面上一个简单的控件+F没有找到任何东西)。

TLDR:如果您在cygwin终端上使用virtualenv,请了解cygwin似乎在安装tensorflow时遇到了问题,并抛出了本文问题中指定的错误(可以在这里(https://stackoverflow.com/a/45230106/8236733)找到类似的情绪(类似的原因,不同的错误))。通过在Windows命令提示符中创建virtualenv来解决。然后可以通过source ./Scripts/activate从cygwin终端访问/激活virtualenv,使用Windows的(不是cygwin的)python。


当只是使用cygwin的python3尝试使用tensorflow,例如。之类的……

apt-cyg install python3-devel
cd python-virtualenv-base
virtualenv -p `which python3` tensorflow-examples

发现使用cygwin的python安装tensorflow-gpu包时存在一些问题。看到了错误

$ PIP install tensorflow 收集tensorflow 无法找到满足tensorflow要求的版本 没有找到匹配的分布张量流

有许多建议的解决方案,没有一个对我的情况有帮助(它们通常都是沿着“您可能已经安装了用于32位架构的python3, tensorflow需要64位”或其他一些python不匹配的错误(而在这里,似乎只是cygwin的python安装tensorflow-gpu有问题))。

最后对我有用的是……

通过Windows系统的官方Windows方式安装python3 (cygwin系统是独立的,因此使用不同的python) 在Windows(不是cygwin终端)中打开命令提示符,然后执行…

C:\Users\me\python-virtualenvs-base>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\me\python-virtualenvs-base>pip -V
pip 9.0.1 from c:\users\me\appdata\local\programs\python\python36\lib\site-packages (python 3.6)

C:\Users\me\python-virtualenvs-base>pip install virtualenv
Collecting virtualenv
  Downloading https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl (1.9MB)
    100% |████████████████████████████████| 1.9MB 435kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-16.0.0
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\me\python-virtualenvs-base>virtualenv tensorflow-examples
Using base prefix 'c:\\users\\me\\appdata\\local\\programs\\python\\python36'
New python executable in C:\Users\me\python-virtualenvs-base\tensorflow-examples\Scripts\python.exe
Installing setuptools, pip, wheel...done.

然后,可以返回cygwin终端,导航回您在命令提示符中创建的virtualenv,并执行…

    ➜  tensorflow-examples source ./Scripts/activate
    (tensorflow-examples) ➜  tensorflow-examples python -V
    Python 3.6.2
    (tensorflow-examples) ➜  tensorflow-examples pip install tensorflow-gpu
    Collecting tensorflow-gpu
      Downloading 
      ....

注意,如果您在cygwin的伪linux环境中创建了virtualenv,那么您不会在virtualenv中执行source ./bin/activate,而是执行source ./Scripts/activate。

我也面临着同样的问题。我尝试了下面的方法,它奏效了。 安装Mac OS X, anaconda python 2.7

PIP卸载tensorflow export TF_BINARY_URL=<从http://tflearn.org/installation/>得到正确的url pip install——upgrade $TF_BINARY_URL

安装tensorflow-1.0.0

2.0兼容方案:

在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Pip安装Tensorflow 2.0:

#Install tensorflow using pip virtual env 
pip install virtualenv
virtualenv tf_2.0.0   # tf_2.0.0 is virtual env name
source tf_2.0.0/bin/activate
#You should see tf_2.0.0 Env now. Execute the below steps
pip install tensorflow==2.0.0
python
>>import tensorflow as tf
>>tf.__version__
2.0.0

在终端(Linux/MacOS)或命令提示符(Windows)中执行以下命令,使用Bazel安装Tensorflow 2.0:

git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow

#The repo defaults to the master development branch. You can also checkout a release branch to build:
git checkout r2.0

#Configure the Build => Use the Below line for Windows Machine
python ./configure.py 

#Configure the Build => Use the Below line for Linux/MacOS Machine
./configure
#This script prompts you for the location of TensorFlow dependencies and asks for additional build configuration options. 

#Build Tensorflow package

#CPU support
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package 

#GPU support
bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true //tensorflow/tools/pip_package:build_pip_package

我在OSX Sierra 10.12.2上遇到了这个问题。原来我安装的Python版本是错误的(我安装的是Python 3.4,但OSX的tensorflow pypi包只适用于Python 3.5及以上版本)。

解决方案是安装Python 3.6。下面是我让它工作的方法。注意:我使用Homebrew来安装Python 3.6,你也可以使用python.org上的Python 3.6安装程序来安装

brew uninstall python3
brew install python3
python3 --version # Verify that you see "Python 3.6.0"
pip install tensorflow # With python 3.6 the install succeeds
pip install jupyter # "ipython notebook" didn't work for me until I installed jupyter
ipython notebook # Finally works!