Python 使用pip未找到TensorFlow

Python 使用pip未找到TensorFlow,python,tensorflow,pip,Python,Tensorflow,Pip,我正在尝试使用pip安装TensorFlow: $pip安装tensorflow--用户 收集张量流 找不到满足tensorflow要求的版本(来自版本:) 找不到tensorflow的匹配分布 我做错了什么?到目前为止,我使用的Python和pip没有任何问题。于2016年11月28日更新:TensorFlow现在在PyPI中提供,从0.12版开始。你可以打字 pip install tensorflow ……或者 pip install tensorflow-gpu …分别安装仅CPU

我正在尝试使用pip安装TensorFlow:

$pip安装tensorflow--用户
收集张量流
找不到满足tensorflow要求的版本(来自版本:)
找不到tensorflow的匹配分布

我做错了什么?到目前为止,我使用的Python和pip没有任何问题。

于2016年11月28日更新:TensorFlow现在在PyPI中提供,从0.12版开始。你可以打字

pip install tensorflow
……或者

pip install tensorflow-gpu
…分别安装仅CPU或GPU加速版本的TensorFlow


上一个答案:TensorFlow尚未在存储库中,因此您必须为您的操作系统和Python版本指定相应“控制盘文件”的URL

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

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

您需要一个64位版本的Python,在您的例子中使用的是32位版本。到目前为止,Tensorflow在Windows上只支持64位版本的Python 3.5.x和3.8.x。请参阅以查看当前支持的内容


要检查正在运行的Python版本,请键入
Python
python3
启动解释器,然后键入
import struct;打印(struct.calcsize(“P”)*8)
,它将打印
32
64
,告诉您正在运行的Python的位版本

来自评论:

要下载不同版本的Python for Windows,请转到并向下滚动,直到看到以“64”结尾的所需版本。这将是64位版本,应与tensorflow网站上的tensorflow一起使用:“您需要pip版本8.1或更高版本才能使用以下命令”。运行此命令升级pip,然后再次尝试安装tensorflow:

pip install --upgrade pip

如果您试图在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中正确的pip)


请记住将Anaconda 3-5.2.0安装为Tensorflow不支持的最新版本3-5.3.0的python版本3.7。

如果您使用的是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安装页面,运行pip安装时需要使用
--ignore installed
标志

然而,在此之前,可以看到这一点 要确保TF_BINARY_URL变量相对于您希望安装的TensorFlow的所需版本设置正确。

请尝试以下操作:

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
来源:(页面已不存在)

更新日期:2017年2月23日
文档移动到:

我发现TensorFlow 1.12.0只适用于Python版本3.5.2。我有Python3.7,但那不起作用。所以,我不得不降级Python,然后我可以安装TensorFlow使其工作

将python版本从3.7降级到3.6

conda install python=3.6.8

我发现这终于奏效了

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上测试的。根据您的配置将
python3
更改为
python
。如果您使用的是Python 2.x,请将url中的
py3
更改为
py2

编辑2:不同版本的列表,如果有人需要:

编辑3:此处提供了可用轮子包的URL列表:

这对我在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

我也遇到了同样的问题,并解决了这个问题:

# 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
加上:

找到了

更新

有新版本的新链接

例如,要在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

我也面临同样的问题。我尝试了以下方法,效果很好。 为Mac OS X安装anaconda python 2.7

pip卸载tensorflow
导出TF_二进制_URL=
pip安装--升级$TF\u二进制\u URL

已安装tensorflow-1.0.0

  • 通过选中AddPython to Path安装python
  • pip3安装--升级

  • 这适用于windows 10.0安装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
    

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

    链接到TensorFlow指南:

  • 使用管理权限启动命令提示符
  • 输入以下命令
    python-mpipinstall--upgrade pip
  • 下一步输入命令
    pip install tensorflow

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

    解决方案

    步骤1:转到TensorFlow安装页面的部分,复制Python安装相关链接的URL

    步骤2:打开终端/命令提示符并运行以下命令:
    pip安装--升级[在此处粘贴复制的url链接]

    所以
     pip3 install --upgrade tensorflow
    
    python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
    
    C:\Users\AppData\Local\Programs\Python\Python36
    C:\Users\AppData\Local\Programs\Python\Python36\Scripts
    
    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.
    
    pip3 install --upgrade tensorflow
    
     python.exe -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
    
    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
    
    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 
        ....
        ....
    
    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
    
    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
    
    !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
    
     python.exe -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl