我正在尝试使用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没有任何问题。


当前回答

我也遇到了同样的问题,问题是我使用的AWS机器有ARM处理器!

我必须手动构建张量流

其他回答

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

当我试图在我的Mac上安装(使用Python 2.7)时,我遇到了同样的错误。根据Yash Kumar Verma在本页上的不同回答,我在这里给出的类似解决方案似乎也适用于Windows 8.1上的Python 3

解决方案

第一步:进入TensorFlow安装页面的TensorFlow Python包的URL部分,复制相关链接的URL用于您的Python安装。

第二步:打开终端/命令提示符,执行以下命令: PIP install -upgrade[在这里粘贴复制的url链接]

所以对我来说是这样的: PIP安装——升级https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl

更新(2017年7月21日):我和其他一些在Windows机器上运行Python 3.6的人尝试了这一点,他们必须将第2步中的行更改为: Python -m PIP install[在这里粘贴复制的url链接]

更新(2018年7月26日):对于Python 3.6.2(不是3.7,因为在TF文档中的3.6.2中),您还可以在步骤2中使用pip3 install——upgrade[粘贴复制的URL]。

Python 3.7适合我,我卸载了Python 3.8.1,重新安装了3.7.6。之后,我执行:

pip3 install --user --upgrade tensorflow

这是可行的

您需要使用正确版本的Python和pip。

在Windows 10上,使用Python 3.6。X版本我也面临同样的问题,然后在仔细检查后,我注意到我的64位机器上安装了Python-32位。记住TensorFlow只兼容64位的Python安装,不兼容32位的Python版本

如果我们从python.org下载Python,默认安装为32位。所以我们必须手动下载64位安装程序来安装Python 64位。然后将以下内容添加到PATH环境中。

C:\Users\AppData\Local\Programs\Python\Python36
C:\Users\AppData\Local\Programs\Python\Python36\Scripts

然后在命令提示符下执行gpupdate /Force。如果Python命令不能用于64位,则重新启动计算机。

然后在命令提示符下运行python。它应该显示64位。

C:\Users\YOURNAME>python
Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

然后执行以下命令安装tensorflow CPU版本(推荐)

pip3 install --upgrade tensorflow

2020年10月更新:

Tensorflow现在支持Python 3.5。通过Python 3.8。X,但您仍然必须使用64位版本。

如果需要在同一台机器上运行多个版本的Python,可以使用虚拟环境来帮助管理它们。

我也面临着同样的问题。我尝试了下面的方法,它奏效了。 安装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