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


当前回答

通过勾选“添加python到路径”来安装python Pip3安装——升级https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

这适用于windows 10.0

其他回答

摘自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

我也有这个问题。当查看不同的.whl文件时。我注意到在python 3.7中没有32位版本的tensorflow。最后只能从这里安装64位Python 3.7。

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

使用管理权限启动命令提示符 输入以下命令python -m pip install——upgrade pip 接下来输入命令pip install tensorflow

登录https://pypi.python.org/pypi/tensorflow查看哪些软件包可用。

在撰写本文时,他们还没有提供源包,因此如果没有为您的平台预先构建的源包,则会出现此错误。如果向pip命令行添加-v,您将看到它遍历PyPI上可用的包,并因不兼容而丢弃它们。

你需要在其他地方找到一个预先构建的包,或者根据https://www.tensorflow.org/install/install_sources上的说明从它的源代码编译tensorflow。

他们有充分的理由不为某些平台开发:

缺少一个win32包,因为TensorFlow的依赖项Bazel只支持win64。 对于win64,只支持3.5+,因为早期版本是用不支持c++ 11的编译器编译的。