我正在尝试使用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

其他回答

正确的安装方法如下所述

$ pip install --upgrade TF_BINARY_URL   # Python 2.7
$ pip3 install --upgrade TF_BINARY_URL  # Python 3.N

从张量流官方主页找到正确的TF_BINARY_URL

你需要一个64位版本的Python,在你的情况下,你使用的是32位版本。到目前为止,Tensorflow只支持64位版本的Python 3.5。X和3.8。Windows操作系统。请参阅安装文档以了解当前支持的内容

要检查您正在运行的Python版本,输入Python或python3启动解释器,然后输入import struct;print(struct.calcsize("P") * 8),这将打印32或64来告诉您正在运行的Python的比特版本。

评论:

要下载不同版本的Windows Python,请访问python.org/downloads/windows并向下滚动,直到看到以“64”结尾的版本。这将是64位版本,应该与张量流一起工作

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

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

当我试图在anaconda包中安装tensorflow时,我遇到了同样的错误。 经过一番努力,我终于找到了一种安装任何包都不会出错的简单方法。 首先使用这个命令在anaconda管理员中创建一个环境

conda create -n packages

现在激活环境

activate packages 

试着跑步

pip install tensorflow 

在成功安装之后,我们需要让jupyter notebook可以访问这个环境。 为此,您需要使用这个命令安装一个名为ipykernel的包

pip install ipykernel

安装ipykernel后,输入以下命令

python -m ipykernel install --user --name=packages

运行此命令后,该环境将被添加到jupyter notebook中 就是这样。 只要打开你的jupyter笔记本,点击新的笔记本,你就能看到你的环境。选择该环境并尝试导入tensorflow,如果你想安装任何其他包,只需激活该环境并安装这些包,并在你的jupyter中使用该环境