使用pip找不到TensorFlow

问题:使用pip找不到TensorFlow

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

I’m trying to intstall TensorFlow using pip:

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

What am I doing wrong? So far I’ve used Python and pip with no issues.


回答 0

我发现这终于奏效了。

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

编辑1:已在Windows(8、8.1、10),Mac和Linux上进行了测试。更改python3python根据您的配置。如果使用的是Python 2.x,请更改py3py2url。

编辑2:如果有人需要,列出不同版本:https : //storage.googleapis.com/tensorflow

编辑3:可用车轮包装的URL列表在此处:https : //www.tensorflow.org/install/pip#package-location

I found this to finally work.

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.12.0-py3-none-any.whl

Edit 1: This was tested on Windows (8, 8.1, 10), Mac and Linux. Change python3 to python according to your configuration. Change py3 to py2 in the url if you are using Python 2.x.

Edit 2: A list of different versions if someone needs: https://storage.googleapis.com/tensorflow

Edit 3: A list of urls for the available wheel packages is available here: https://www.tensorflow.org/install/pip#package-location


回答 1

您需要Python的64位版本,而您使用的是32位版本。到目前为止,Tensorflow仅64-bit versions of Python 3.5.x and 3.6.x在Windows上支持。请参阅安装文档以了解当前支持什么

要检查您正在运行的Python版本,请键入pythonpython3启动解释器,然后键入import struct;print(struct.calcsize("P") * 8)和将打印3264告诉您您正在运行的Python版本。

来自评论:

要下载适用于Windows的其他版本的Python,请访问python.org/downloads/windows并向下滚动,直到看到所需的版本以“ 64”结尾。那将是应该与tensorflow一起使用的64位版本

You need a 64-bit version of Python and in your case are using a 32-bit version. As of now Tensorflow only supports 64-bit versions of Python 3.5.x and 3.6.x on Windows. See the install docs to see what is currently supported

To check which version of Python you are running, type python or python3 to start the interpreter, and then type import struct;print(struct.calcsize("P") * 8) and that will print either 32 or 64 to tell you which bit version of Python you are running.

From comments:

To download a different version of Python for Windows, go to python.org/downloads/windows and scroll down until you see the version you want that ends in a “64”. That will be the 64 bit version that should work with tensorflow


回答 2

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

在Windows 10(使用Python 3.6.X版本)上,我经过仔细检查后面临着相同的问题,然后发现我在64位计算机上安装了Python-32位。记住TensorFlow 仅与 python的64位安装兼容不是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

更新-Python 3.7

目前仅正式支持Python 3.5和Python 3.6。Tensorflow尚未正式发布Python 3.7的二进制文件,我们可能需要稍等片刻才能发布它。您可以暂时使用Python 3.6.x或具有Python <3.7虚拟环境的Anaconda。

You need to use right version of Python and pip

On Windows 10, with Python 3.6.X version I was facing same then after checking deliberately , I noticed I had Python-32 bit installation on my 64 bit machine. Remember TensorFlow is only compatible with 64bit installation of python. Not 32 bit of Python

If we download Python from python.org , the default installation would be 32 bit. So we have to download 64 bit installer manually to install Python 64 bit. And then add below to PATH environment.

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

Then run gpupdate /Force on command prompt. If python command doesnt work for 64 bit restart your machine.

Then run python on command prompt. It should show 64 bit

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.

Then run below command to install tensorflow CPU version(recommended)

pip3 install --upgrade tensorflow

Update – Python 3.7

Currently only Python 3.5 and Python 3.6 are supported officially. Tensorflow has not released binaries for Python 3.7 still officially, we might need to wait a little for it to be released. You can use Python 3.6.x alongside or Anaconda with Python<3.7 virtual environment for time being.


回答 3

从tensorflow网站:“您将需要pip版本8.1或更高版本,以下命令才能工作”。运行以下命令以升级您的pip,然后尝试再次安装tensorflow:

pip install --upgrade pip

From tensorflow website: “You will need pip version 8.1 or later for the following commands to work”. Run this command to upgrade your pip, then try install tensorflow again:

pip install --upgrade pip

回答 4

如果您尝试将其安装在Windows计算机上,则需要安装64位版本的python 3.5。这是实际安装它的唯一方法。从网站

TensorFlow在Windows上仅支持64位Python 3.5。我们已经使用以下Python发行版对pip包进行了测试:

Anaconda的Python 3.5

来自python.org的Python 3.5。

您可以从此处下载正确版本的python (确保您抓住显示“ Windows x86-64”的版本之一)

现在,您应该可以使用pip install tensorflow或进行安装python -m pip install tensorflow(如果同时安装了python2和python3,请确保使用的是来自python3的正确点子)

请记住要安装Anaconda 3-5.2.0,因为3-5.3.0的最新版本具有Tensorflow不支持的python 3.7版本。

If you are trying to install it on a windows machine you need to have a 64-bit version of python 3.5. This is the only way to actually install it. From the website:

TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages with the following distributions of Python:

Python 3.5 from Anaconda

Python 3.5 from python.org.

You can download the proper version of python from here (make sure you grab one of the ones that says “Windows x86-64”)

You should now be able to install with pip install tensorflow or python -m pip install tensorflow (make sure that you are using the right pip, from python3, if you have both python2 and python3 installed)

Remember to install Anaconda 3-5.2.0 as the latest version which is 3-5.3.0 have python version 3.7 which is not supported by Tensorflow.


回答 5

我发现TensorFlow 1.12.0仅适用于Python版本3.5.2。我有Python 3.7,但没有用。因此,我不得不降级Python,然后可以安装TensorFlow使其工作。

要将python版本从3.7降级到3.6

conda install python=3.6.8

I figured out that TensorFlow 1.12.0 only works with Python version 3.5.2. I had Python 3.7 but that didn’t work. So, I had to downgrade Python and then I could install TensorFlow to make it work.

To downgrade your python version from 3.7 to 3.6

conda install python=3.6.8

回答 6

2016年11月28日更新:从0.12版开始,PyPI中现已提供TensorFlow。您可以输入

pip install tensorflow

…要么…

pip install tensorflow-gpu

…分别安装仅CPU或GPU加速的TensorFlow版本。


先前的答案: TensorFlow尚未存在于PyPI存储库中,因此您必须为操作系统和Python版本指定适当的“ wheel文件”的URL。

TensorFlow网站上列出了受支持的配置的完整列表,但是例如,要仅使用CPU在Linux上为Python 2.7安装版本0.10,您可以键入以下命令:

$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl

Updated 11/28/2016: TensorFlow is now available in PyPI, starting with release 0.12. You can type

pip install tensorflow

…or…

pip install tensorflow-gpu

…to install the CPU-only or GPU-accelerated version of TensorFlow respectively.


Previous answer: TensorFlow is not yet in the PyPI repository, so you have to specify the URL to the appropriate “wheel file” for your operating system and Python version.

The full list of supported configurations is listed on the TensorFlow website, but for example, to install version 0.10 for Python 2.7 on Linux, using CPU only, you would type the following command:

$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl

回答 7

在此处安装Python 3.5.x 64位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

Install Python 3.5.x 64 bit amd version here. Make sure you add Python to your PATH variable. Then open a command prompt and type

python -m pip install --upgrade pip

should give you the following result :

 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

Now type

 pip3 install --upgrade tensorflow

回答 8

我有同样的问题,并解决了这个问题:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.

# Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl

# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl

加:

# Python 2
(tensorflow)$ pip install --upgrade $TF_BINARY_URL

# Python 3
(tensorflow)$ pip3 install --upgrade $TF_BINARY_URL

Docs上找到。

更新!

新版本的新链接

例如,要在OSX中安装tensorflow v1.0.0,您需要使用:

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py2-none-any.whl

代替

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

I had the same problem and solved with this:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.

# Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl

# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl

Plus:

# Python 2
(tensorflow)$ pip install --upgrade $TF_BINARY_URL

# Python 3
(tensorflow)$ pip3 install --upgrade $TF_BINARY_URL

Found on Docs.

UPDATE!

There are new links for new versions

For example, for installing tensorflow v1.0.0 in OSX you need to use:

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py2-none-any.whl

instead of

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

回答 9

尝试在Mac上安装(使用Python 2.7)时出现相同的错误。根据Yash Kumar Verma在此页面上给出的不同答案,与我在此处提供的解决方案类似的解决方案似乎也适用于Windows 8.1上的Python 3。

步骤1:前往TensorFlow安装页面的TensorFlow Python软件包的URL部分,并复制与您的Python安装相关的链接的URL。

步骤2:打开终端/命令提示符并运行以下命令:
pip install --upgrade [paste copied url link here]

所以对我来说是这样的:
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl

更新(2017年7月21日):我与其他在运行Windows 3.6且使用Python 3.6的计算机上进行了尝试,他们不得不将步骤2中的行更改为: python -m pip install [paste copied url link here]

更新(2018年7月26日):对于Python 3.6.2(不是3.7,因为它在TF文档中的3.6.2中),您也可以pip3 install --upgrade [paste copied URL here]步骤2中使用。

I had the same error when trying to install on my Mac (using Python 2.7). A similar solution to the one I’m giving here also seemed to work for Python 3 on Windows 8.1 according to a different answer on this page by Yash Kumar Verma

Solution

Step 1: go to The URL of the TensorFlow Python package section of the TensorFlow installation page and copy the URL of the relevant link for your Python installation.

Step 2: open a terminal/command prompt and run the following command:
pip install --upgrade [paste copied url link here]

So for me it was the following:
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.2.0-py2-none-any.whl

Update (July 21 2017): I tried this with some others who were running on Windows machines with Python 3.6 and they had to change the line in Step 2 to: python -m pip install [paste copied url link here]

Update (26 July 2018): For Python 3.6.2 (not 3.7 because it’s in 3.6.2 in TF Documentation), you can also use pip3 install --upgrade [paste copied URL here] in Step 2.


回答 10

试试这个,它应该可以工作:

 python.exe -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

Try this, it should work:

 python.exe -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

回答 11

尝试这个:

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl
pip3 install --upgrade $TF_BINARY_URL

来源:https//www.tensorflow.org/get_started/os_setup(页面不再存在)

更新2/23/17 文档已移至:https : //www.tensorflow.org/install

Try this:

export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl
pip3 install --upgrade $TF_BINARY_URL

Source: https://www.tensorflow.org/get_started/os_setup (page no longer exists)

Update 2/23/17 Documentation moved to: https://www.tensorflow.org/install


回答 12

  1. 通过选中将Python添加到路径来安装python
  2. pip3 install –upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

这适用于Windows 10.0

  1. Install python by checking Add Python to Path
  2. pip3 install –upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

This works for windows 10.0


回答 13

如果您最近遇到过此问题(例如,在2018年发布Python 3.7之后),则很可能是由于tensorflow方面缺少Python 3.7支持所致。如果您不介意,请尝试使用Python 3.6。您可以从https://github.com/tensorflow/tensorflow/issues/20444中找到一些技巧,但使用这些技巧需要您自担风险。我使用了建议的一个竖琴-首先下载了适用于Python 3.6的tensorflow轮,然后手动将其重命名…

cp tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whl tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl
pip install tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl

好消息是已经有对3.7支持的请求。希望它将尽快发布。

If you run into this issue recently (say, after Python 3.7 release in 2018), most likely this is caused by the lack of Python 3.7 support (yet) from the tensorflow side. Try using Python 3.6 instead if you don’t mind. There are some tricks you can find from https://github.com/tensorflow/tensorflow/issues/20444, but use them at your own risk. I used the one harpone suggested – first downloaded the tensorflow wheel for Python 3.6 and then renamed it manually…

cp tensorflow-1.11.0-cp36-cp36m-linux_x86_64.whl tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl
pip install tensorflow-1.11.0-cp37-cp37m-linux_x86_64.whl

The good news is that there is a pull request for 3.7 support already. Hope it will be released soon.


回答 14

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

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

I had the same problem. After uninstalling the 32-bit version of python and reinstalling the 64-bit version I tried reinstalling TensorFlow and it worked.

Link to TensorFlow guide: https://www.tensorflow.org/install/install_windows


回答 15

如果您试图在anaconda中安装tensorflow并且它无法正常工作,则您可能需要降级python版本,因为只有3.6.xanaconda具有最新版本时才支持python 版本。

  1. 检查python版本: python --version

  2. 如果版本>,3.6.x然后执行步骤3,否则请停止,问题可能出在其他地方

  3. conda search python

  4. conda install python=3.6.6

  5. 再次检查版本: python --version

  6. 如果版本正确,请安装tensorflow(步骤7)

  7. pip install tensorflow

If you’re trying to install tensorflow in anaconda and it isn’t working, then you may need to downgrade python version because only 3.6.x is currently supported while anaconda has the latest version.

  1. check python version: python --version

  2. if version > 3.6.x then follow step 3, otherwise stop, the problem may be somewhere else

  3. conda search python

  4. conda install python=3.6.6

  5. Check version again: python --version

  6. If version is correct, install tensorflow (step 7)

  7. pip install tensorflow


回答 16

如果您正在使用Anaconda Python安装,pip install tensorflow将给出上述错误,如下所示:

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

根据TensorFlow安装页面,--ignore-installed在运行pip install时需要使用该标志。

但是,在执行此操作之前,请先查看此链接, 以确保相对于希望安装的TensorFlow所需版本正确设置了TF_BINARY_URL变量。

If you are using the Anaconda Python installation, pip install tensorflow will give the error stated above, shown below:

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

According to the TensorFlow installation page, you will need to use the --ignore-installed flag when running pip install.

However, before this can be done see this link to ensure the TF_BINARY_URL variable is set correctly in relation to the desired version of TensorFlow that you wish to install.


回答 17

不幸的是,我的声誉是在@Sujoy答案下无法控制的。

他们在文档中声称支持python 3.6。@mayur提供的链接表明它们确实只是一个python3.5 wheel软件包。这是我尝试安装tensorflow:

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\python\v3\lib\site-packages (10.0.0)

C:\>python3 -m pip -V
pip 10.0.0 from D:\Python\V3\lib\site-packages\pip (python 3.6)

C:\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

而python 3.5似乎已成功安装。我希望看到一个python3.6版本,因为他们声称它也可以在python3.6上运行。

引用:

"TensorFlow supports Python 3.5.x and 3.6.x on Windows. Note that Python 3 comes with the pip3 package manager, which is the program you'll use to install TensorFlow."

来源:https : //www.tensorflow.org/install/install_windows

Python3.5安装:

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\python\v3\lib\site-packages (10.0.0)

C:\>python3 -m pip -V
pip 10.0.0 from D:\Python\V3_5\lib\site-packages\pip (python 3.5.2)

C:\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
  Downloading 
    ....
    ....

我希望我在这里错得很厉害,但是如果不敲响警钟😛

编辑:有人下面的几篇文章指出以下命令将起作用,并且确实起作用。

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

奇怪的点不起作用🤔

Unfortunately my reputation is to low to command underneath @Sujoy answer.

In their docs they claim to support python 3.6. The link provided by @mayur shows that their is indeed only a python3.5 wheel package. This is my try to install tensorflow:

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\python\v3\lib\site-packages (10.0.0)

C:\>python3 -m pip -V
pip 10.0.0 from D:\Python\V3\lib\site-packages\pip (python 3.6)

C:\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

while python 3.5 seems to install successfully. I would love to see a python3.6 version since they claim it should also work on python3.6.

Quoted :

"TensorFlow supports Python 3.5.x and 3.6.x on Windows. Note that Python 3 comes with the pip3 package manager, which is the program you'll use to install TensorFlow."

Source : https://www.tensorflow.org/install/install_windows

Python3.5 install :

Microsoft Windows [Version 10.0.16299.371]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\>python3 -m pip install --upgrade pip
Requirement already up-to-date: pip in d:\python\v3\lib\site-packages (10.0.0)

C:\>python3 -m pip -V
pip 10.0.0 from D:\Python\V3_5\lib\site-packages\pip (python 3.5.2)

C:\>python3 -m pip install --upgrade tensorflow
Collecting tensorflow
  Downloading 
    ....
    ....

I hope i am terrible wrong here but if not ring a alarm bell 😛

Edit: A couple of posts below someone pointed out that the following command would work and it did.

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

Strange pip is not working 🤔


回答 18

在Mac OS X Yosemite 10.10.5上的Python 2.7中,这对我有用:

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

This worked for me with Python 2.7 on Mac OS X Yosemite 10.10.5:

sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl

回答 19

这个问题有多组答案。该答案旨在概括一组答案:

可能没有与您的Python版本兼容的TensorFlow版本。如果您正在使用新版本的Python,则尤其如此。例如,在新版本的Python发行与该版本的Python的TensorFlow发行之间可能会有延迟。

在这种情况下,我相信您的选择是:1)降级到Python的先前版本。2)从源代码编译TensorFlow。3)等待TensorFlow的匹配版本。

There are multiple groups of answers to this question. This answer aims to generalize one group of answers:

There may not be a version of TensorFlow that is compatible with your version of Python. This is particularly true if you’re using a new release of Python. For example, there may be a delay between the release of a new version of Python and the release of TensorFlow for that version of Python.

In this case, I believe your options are to: 1) Downgrade to the previous version of Python. 2) Compile TensorFlow from the source code. 3) Wait for a matching version of TensorFlow.


回答 20

对于Windows,这对我有用

从此链接下载车轮。然后从命令行导航到存在转轮的下载文件夹,只需键入以下命令-

pip install tensorflow-1.0.0-cp36-cp36m-win_amd64.whl

For windows this worked for me,

Download the wheel from this link. Then from command line navigate to your download folder where the wheel is present and simply type in the following command –

pip install tensorflow-1.0.0-cp36-cp36m-win_amd64.whl


回答 21

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

pip uninstall tensorflow export TF_BINARY_URL=<get the correct url from http://tflearn.org/installation/> pip install --upgrade $TF_BINARY_URL

安装了tensorflow-1.0.0

I was facing the same issue. I tried the following and it worked. installing for Mac OS X, anaconda python 2.7

pip uninstall tensorflow export TF_BINARY_URL=<get the correct url from http://tflearn.org/installation/> pip install --upgrade $TF_BINARY_URL

Installed tensorflow-1.0.0


回答 22

  1. 具有管理权限启动命令提示符
  2. 输入以下命令 python -m pip install --upgrade pip
  3. 下一步输入命令 pip install tensorflow
  1. Start Command Prompt with Administrative Permission
  2. Enter following command python -m pip install --upgrade pip
  3. Next Enter command pip install tensorflow

回答 23

下面是在Windows中安装TensorFlow的URL。对我来说很好。

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

The URL to install TensorFlow in Windows, below is the URL. It worked fine for me.

python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

回答 24

在Windows 10上,这里没有任何内容适合我。也许下面的更新解决方案对我有用。

python -m pip install --upgrade tensorflow

这在Windows 10上使用Python 3.6tensorflow 1.5

Nothing here worked for me on Windows 10. Perhaps an updated solution below that did work for me.

python -m pip install --upgrade tensorflow.

This is using Python 3.6 and tensorflow 1.5 on Windows 10


回答 25

对于pyCharm用户:

  1. 检查pip版本: pip3 -V
  2. 如果pip早于9.0.1: py -3 -m pip install –upgrade pip
  3. 然后:** py -3 -m pip install –upgrade

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl **

For pyCharm users:

  1. Check pip version: pip3 -V
  2. If pip is older than 9.0.1: py -3 -m pip install –upgrade pip
  3. Then: **py -3 -m pip install –upgrade

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl**


回答 26

以下步骤允许您安装tensorflow和keras

  1. https://repo.anaconda.com/archive/下载python 3.6随附的Anaconda3-5.2.0
  2. 安装Anaconda并打开Anaconda Prompt并执行以下命令 conda install jupyter conda install scipy pip install sklearn pip install msgpack pip install pandas pip install pandas-datareader pip install matplotlib pip install pillow pip install requests pip install h5py pip install tensorflow pip install keras

Following steps allows you to install tensorflow and keras

  1. downloading Anaconda3-5.2.0 which comes with python 3.6 from https://repo.anaconda.com/archive/
  2. Install Anaconda and open Anaconda Prompt and execute below commands conda install jupyter conda install scipy pip install sklearn pip install msgpack pip install pandas pip install pandas-datareader pip install matplotlib pip install pillow pip install requests pip install h5py pip install tensorflow pip install keras

回答 27

2019年更新:要在Google Colab中安装TensorFlow 2预览版,可以使用:

!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb !dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb !apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub !apt-get update !apt-get install cuda !pip install tf-nightly-gpu-2.0-preview

对于安装TensorFlow 2 bye pip,您可以使用: pip install tf-nightly-gpu-2.0-preview用于GPU和 pip install tf-nightly-2.0-preview CPU。

update 2019: for install the preview version of TensorFlow 2 in Google Colab you can use:

!wget https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64 -O cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb !dpkg -i cuda-repo-ubuntu1604-10-0-local-10.0.130-410.48_1.0-1_amd64.deb !apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub !apt-get update !apt-get install cuda !pip install tf-nightly-gpu-2.0-preview

and for install the TensorFlow 2 bye pip you can use : pip install tf-nightly-gpu-2.0-preview for GPU and pip install tf-nightly-2.0-preview for CPU.


回答 28

我在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!

I had this problem on OSX Sierra 10.12.2. It turns out I had the wrong version of Python installed (I had Python 3.4 but tensorflow pypi packages for OSX are only for python 3.5 and up).

The solution was to install Python 3.6. Here’s what I did to get it working. Note: I used Homebrew to install Python 3.6, you could do the same by using the Python 3.6 installer on python.org

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!

回答 29

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

使用本机pip安装

如果您的计算机上未安装以下版本的Python,请立即安装:

python.org中的Python 3.5.x TensorFlow在Windows上仅支持Python的3.5.x版本。请注意,Python 3.5.x随附pip3软件包管理器,这是您将用于安装TensorFlow的程序。

要安装TensorFlow,请启动终端。然后在该终端中发出适当的pip3 install命令。要安装TensorFlow的仅CPU版本,请输入以下命令:

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

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

Excerpt from tensorflow website 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