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


当前回答

按照以下步骤安装tensorflow和keras:

从https://repo.anaconda.com/archive/下载python 3.6附带的Anaconda3-5.2.0 安装Anaconda并打开Anaconda提示符并执行以下命令 Conda安装jupyter Conda安装scipy PIP安装sklearn PIP安装msgpack PIP安装熊猫 PIP安装panda -datareader PIP安装matplotlib PIP安装枕 PIP安装请求 PIP install h5py PIP安装tensorflow PIP安装keras

其他回答

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 3.5。x64位amd版本。确保将Python添加到PATH变量中。然后打开命令提示符并键入

python -m pip install --upgrade pip

应该会给你以下结果:

 Collecting pip
 Using cached pip-9.0.1-py2.py3-none-any.whl
 Installing collected packages: pip
 Found existing installation: pip 7.1.2
 Uninstalling pip-7.1.2:
 Successfully uninstalled pip-7.1.2
 Successfully installed pip-9.0.1

现在式

 pip3 install --upgrade tensorflow

目前PIP没有32位版本的tensorflow,当我卸载python 32位并安装x64时,它可以工作

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

如果你试图在Windows上安装Anaconda Tensorflow,一个免费的建议是请卸载Anaconda,并从发布页面下载一个64位的Python版本,以amd64结尾。对我来说,它是python-3.7.8-amd64.exe

然后按照Tensorflow官方网站上的说明在虚拟环境中安装Tensorflow。