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


当前回答

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

其他回答

我知道这个问题很老了,但最近我在MacBook Air M1上遇到了这个问题。解决方案是使用pip install tensorflow-macos命令。

如果你的命令pip install——upgrade tensorflowcompililes,那么你的tensorflow版本应该是最新的。我个人更喜欢用水蟒。tensorflow可以简单地安装和升级:

 conda install -c conda-forge tensorflow  # to install
 conda upgrade -c conda-forge tensorflow  # to upgrade

另外,如果你想用你的GPU使用它,你有一个简单的安装:

 conda install -c anaconda tensorflow-gpu

我已经用了一段时间了,从来没有任何问题。

你需要一个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位版本,应该与张量流一起工作

这是我的环境(Windows 10与NVIDIA GPU)。我想安装TensorFlow 1.12-gpu,多次失败,但能够通过以下方法解决。

这有助于在Windows 10系统上安装TensorFlow-GPU

步骤:

确保你有NVIDIA显卡

a.打开windows资源管理器,打开设备管理器—>,检查“Display” 适配器”—>它将显示(例如NVIDIA GeForce)如果你有GPU它 将显示“高清图形” b.如果GPU是AMD的,那么tensorflow不支持AMD的GPU

如果您有GPU,请检查GPU是否支持CUDA特性。

a.如果你在这个链接找到你的GPU型号,那么它支持CUDA。 b.如果你没有CUDA GPU,那么你只能安装 Tensorflow(不带gpu)

Tensorflow要求python-64bit版本。卸载所有python依赖项

a.进入控制面板->搜索“程序和功能”,然后 搜索“python” b.卸载anaconda和任何与python相关的插件。 这些依赖关系可能会干扰tensorflow-GPU 安装。 c.确保python已经卸载。打开命令提示符并键入 " python ",如果它抛出一个错误,那么你的系统没有python和 您可以继续重新安装python

重新安装python

a.TF1.12支持最高至Python 3.6.6。请按此处下载视窗 X86-64可执行安装程序 b.安装时,选择“Add Python 3.6 to PATH”,然后单击 “现在安装”。

c. python安装成功后,进入安装界面 方法之一,提供禁用路径长度限制的选项 Windows 10中Tensorflow构建/安装问题的根本原因 环境。单击“禁用路径长度限制”,然后执行 完成安装的说明。

d.检查python是否正确安装。打开命令提示符 然后输入“python”。它应该显示Python的版本。

安装Visual Studio

Visual Studio 2017社区

a.点击上方的“Visual Studio链接”。下载Visual Studio 2017社区。 b.在左侧“Visual Studio IDE”下,选择“community 2017” 下载它 c.在安装过程中,选择“Desktop development with c++” 安装

CUDA 9.0工具箱

https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

a.点击上方“CUDA 9.0工具包链接”,下载“Base Installer” b.安装CUDA 9.0

安装 cuDNN

https://developer.nvidia.com/cudnn

a. Click "Link to Install cuDNN" and select “I Agree To the Terms of the cuDNN Software License Agreement” b. Register for login, check your email to verify email address c. Click “cuDNN Download” and fill a short survey to reach “cuDNN Download” page d. Select “ I Agree To the Terms of the cuDNN Software License Agreement” e. Select “Download cuDNN v7.5.0 (Feb 21, 2019), for CUDA 9.0" f. In the dropdown, click “cuDNN Library for Windows 10” and download g. Go to the folder where the file was downloaded, extract the files

h.将解压缩文件中的三个文件夹(bin、include、lib)添加到 环境

i.在windows 10搜索栏中输入“environment”,找到 在“环境变量”中,单击“用户变量”中的“路径” 点击“编辑”,然后选择“新建”,将这三条路径添加到 三个“cuda”文件夹 j.关闭“环境变量”窗口。

安装tensorflow-gpu

a.打开命令提示符,输入“pip install” ——升级tensorflow-gpu” b.安装tensorflow-gpu

检查安装是否正确

a.在命令提示符下输入“python” b.输入“import tensorflow as tf” c你好=特遣部队。常数(“Hello World !”) d .税= tf.Session () e. print(sess.run(hello))——> hello World!

测试tensorflow是否使用GPU

A.从tensorflow.python.client导入device_lib print (device_lib.list_local_devices ()) b . print (device_lib.list_local_devices ())

我的环境:Win 10, python 3.6

pip3 install --upgrade tensorflow
pip install --upgrade tensorflow

错误:

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

我还尝试了pip install tensorflow和pip install tensorflow-gpu。 但错误:

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

使用Step (https://www.tensorflow.org/install/install_windows)尝试安装OK

Follow the instructions on the Anaconda download site to download and install Anaconda. https://www.continuum.io/downloads Create a conda environment named tensorflow by invoking the following command: C:> conda create -n tensorflow pip python=3.5 Activate the conda environment by issuing the following command: C:> activate tensorflow (tensorflow)C:> # Your prompt should change Issue the appropriate command to install TensorFlow inside your conda environment. To install the CPU-only version of TensorFlow, enter the following command: (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow To install the GPU version of TensorFlow, enter the following command (on a single line): (tensorflow)C:> pip install --ignore-installed --upgrade tensorflow-gpu