我正在尝试使用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 3.9,无法用pip安装tensorflow。

然后我卸载了3.9,然后安装了3.8.7,成功…tensorflow支持的最大版本是3.8。X(2021年) 所以,检查你的python版本是否与当前的tensorflow兼容。

其他回答

以下是我为Windows 10所做的!我也没有打扰之前的Python 2.7安装

步骤1:从链接安装Windows x86-64可执行安装程序: https://www.python.org/downloads/release/python-352/

步骤2:以管理员身份打开cmd

步骤3:输入以下命令:

pip install https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl

您应该看到它可以正常工作,如下图所示,我还尝试了示例示例。

使用Git更容易,他们提供了网站上的方法,但链接访问可能不是很重要,你可以从中读取

引用https://www.tensorflow.org/install/source_windows

git clone https://github.com/tensorflow/tensorflow.git

我的Python版本是3.9.7。我也使用Windows 10,要求如下:

1. Microsoft C++ Retribution installed from Microsoft Visual Studio that matches with x64bits as required in the list.

1.1 Microsoft Visual C++ 2012 Redistribution ( x64 ) and updates    
1.2 Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.40664
1.3 Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.29.30133
1.4 vs_community__1795732196.1624941787.exe updates

2. Python and AI learning 
tensorboard                2.6.0
tensorboard-data-server    0.6.1
tensorboard-plugin-profile 2.5.0
tensorboard-plugin-wit     1.8.0
***tensorflow                 2.6.0
tensorflow-datasets        4.4.0
tensorflow-estimator       2.6.0
***tensorflow-gpu             2.6.0
tensorflow-hub             0.12.0
tensorflow-metadata        1.2.0
tensorflow-text            2.6.0
***PyOpenGL                   3.1.5
pyparsing                  2.4.7
python-dateutil            2.8.2
python-slugify             5.0.2
python-speech-features     0.6
PyWavelets                 1.1.1
PyYAML                     5.4.1
scikit-image               0.18.3
scikit-learn               1.0.1
***gym                        0.21.0

对于窗口,您可以使用以下命令

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.3.0-cp38-cp38-win_amd64.whl

如果你最近遇到了这个问题(比如,在2018年Python 3.7发布之后),这很可能是由于tensorflow方面缺乏Python 3.7支持造成的。如果您不介意,可以尝试使用Python 3.6。你可以从https://github.com/tensorflow/tensorflow/issues/20444上找到一些技巧,但使用它们的风险由你自己承担。我使用了harpone建议的方法——首先下载Python 3.6的tensorflow wheel,然后手动重命名它……

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支持的pull请求。希望能尽快发布。

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

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