简体   繁体   English

错误:找不到满足 tensorflow 要求的版本(来自版本:无)错误:没有找到 tensorflow 的匹配分布)

[英]ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow)

I want to install tensorflow to use Keras LSTM I installed Keras, and i import this lines to my code.我想安装 tensorflow 以使用 Keras LSTM 我安装了 Keras,并将此行导入我的代码。

from keras.callbacks import LambdaCallback
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.layers import LSTM
from keras.optimizers import RMSprop

Error is when runnig the code:错误是在运行代码时:

No module named 'tensorflow'

Cmd error when i write "pip install tensorflow": Cmd 写“pip install tensorflow”时出错:

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

Pip version is 19.3, python version 3.7 Pip版本为19.3,python版本为3.7

On Windows , you must use Python 3.7.6 (64 bits) to install tensorflow :Windows 上,您必须使用Python 3.7.6(64 位)来安装tensorflow

C:\Program Files\Python-3.7.6-x64> python.exe -m pip install --user tensorflow

Unfortunately, the 32-bit version is not supported by tensorflow and will give you that nasty error:不幸的是,tensorflow 不支持 32 位版本,并且会给您带来令人讨厌的错误:

Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow找不到满足 tensorflow 要求的版本(来自版本:无)错误:未找到 tensorflow 的匹配分布

A few important notes:几个重要的注意事项:

  • Install Microsoft Visual C++ Redistributable packages for x64 (2015, 2017, 2019).安装适用于 x64(2015、2017、2019)的 Microsoft Visual C++ 可再发行包
  • If you have previously installed Python 3.7 for x86, uninstall it from your system and also delete the directory where the x86 packages were stored to avoid a conflict with the new x64 packages that will be placed there.如果您以前为 x86 安装了 Python 3.7,请将其从系统中卸载,并删除存储 x86 软件包的目录以避免与新的软件包发生冲突。 In my machine they were stored at C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages .在我的机器中,它们存储在C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages
  • Finally, install Python 3.7.6 (x64) and upgrade pip with python -m pip install --user --upgrade pip . Finally, install Python 3.7.6 (x64) and upgrade pip with python -m pip install --user --upgrade pip .
  • Now, simply install tensorflow: python -m pip install --user tensorflow现在,只需安装 tensorflow: python -m pip install --user tensorflow

Solution解决方案

I figured out that the issue is with the Python version.我发现问题出在 Python 版本上。

  • ie: python 3.8.1 doesn't have the support for Tensorflow 3.8.1即:python 3.8.1 不支持 Tensorflow 3.8.1

So I downgraded Python version from 3.8.1 to 3.7.6 Later I worked fine所以我将Python版本从3.8.1降级到3.7.6后来我工作正常

pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl

My System Specification我的系统规格

  • Windows 10 Windows 10
  • python 3.8.1 python 3.8.1
  • pip 19.3.1 pip 19.3.1

For others who faced this problem, TensorFlow might not support the version you are running yet.对于遇到此问题的其他人,TensorFlow 可能还不支持您正在运行的版本。 At the time of writing, you will get the same error when running Python 3.9 and trying to install TensorFlow.在撰写本文时,您在运行 Python 3.9 并尝试安装 TensorFlow 时会遇到相同的错误。 You need to ensure your Python version is supported by TensorFlow.您需要确保 TensorFlow 支持您的 Python 版本。

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

TensorFlow is tested and supported on the following 64-bit systems: TensorFlow 在以下 64 位系统上经过测试和支持:

  • Python 3.5–3.8 Python 3.5–3.8

I then used a different python.然后我使用了不同的 python。 ie python3.8 -m pip install tensorflow==2.3.0python3.8 -m pip install tensorflow==2.3.0

Hi writing my suggestions here because i can't commment yet.嗨,在这里写下我的建议,因为我还不能发表评论。

Could you try to look if you have the right python version installed?您能否尝试查看是否安装了正确的 python 版本? Sometimes something went wrong and a 32-bit version of python is installed.有时出现问题并安装了 32 位版本的 python。 But tensorflow only works with the 64 bit verison of python.但是 tensorflow 仅适用于 python 的 64 位版本。 You can check your python version with the following comand into the python interpreter您可以使用以下命令在 python 解释器中检查您的 python 版本

import struct
print struct.calcsize("P") * 8

It should print "64".它应该打印“64”。

It generally seems that there is a problem with python 3.7 and tensorflow ( here )一般似乎 python 3.7 和 tensorflow 有问题(这里

For some people there it helped to install a specific tensorflow version对于那里的某些人来说,它有助于安装特定的 tensorflow 版本

pip install tensorflow==1.14.0

as also seen here.这里也可以看到。

Also a solution might be to downgrade to phyton 3.6.一个解决方案可能是降级到 phyton 3.6。

For 3.6: Another possible solution can be found in this thread (For Windows only for Python 3.6 as of the date of this answer)对于 3.6:另一种可能的解决方案可以在此线程中找到(对于 Windows 仅适用于 Python 3.6 截至本答案日期)

TLDR: The most upvoted answer suggestes to try following input (for python 3.6 CPU-only) TLDR:最受好评的答案建议尝试以下输入(仅适用于 python 3.6 CPU)

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-2.0.0-cp36-cp36m-win_amd64.whl

I hope this helps to solve your problem.我希望这有助于解决您的问题。

This solution always worked for me.这个解决方案一直对我有用。

1) Figure out what Python interpreter you are actually using 1)弄清楚你实际使用的是什么 Python 解释器

import sys
print(sys.executable) #prints "path_to_python"

2) On the terminal run: "path_to_python" -m pip install tensorflow where "path_to_python" is the output you got before, obviously. 2)在终端运行: "path_to_python" -m pip install tensorflow其中"path_to_python"显然是你之前得到的 output。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:找不到满足 tensorflow 要求的版本(来自版本:无) - ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) 错误:找不到满足 mathplotlib 要求的版本(来自版本:无)错误:找不到 mathplotlib 的匹配分布 - ERROR: Could not find a version that satisfies the requirement mathplotlib (from versions: none) ERROR: No matching distribution found for mathplotlib 错误:找不到满足要求的版本 os(来自版本:无) 错误:找不到匹配的发行版 os - ERROR: Could not find a version that satisfies the requirement os (from versions: none) ERROR: No matching distribution found for os 错误:找不到满足火炬要求的版本(来自版本:无)错误:找不到火炬的匹配分布 - ERROR: Could not find a version that satisfies the requirement torch (from versions: none) ERROR: No matching distribution found for torch 找不到满足张量流要求的版本(来自版本:)没有找到张量流的匹配分布 - Could not find a version that satisfies the requirement tensorflow (from versions:) No matching distribution found for tensorflow Mac using:Could not find a version that satisfied the tensorflow (from versions:) No matching distribution found for tensorflow - Mac using:Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow 找不到满足tensorflow> = 1.7.0的版本(来自版本:)找不到与tensorflow> = 1.7.0匹配的分布 - Could not find a version that satisfies the requirement tensorflow>=1.7.0 (from versions: ) No matching distribution found for tensorflow>=1.7.0 错误:找不到满足 tensorflow==2.1.0 要求的版本,并且未找到 tensorflow==2.1.0 的匹配分布 - ERROR: Could not find a version that satisfies the requirement tensorflow==2.1.0 and No matching distribution found for tensorflow==2.1.0 错误:无法从版本中找到满足 Django==1.10.5 要求的版本:无错误:未找到匹配的发行版 Django==1.10.5 - ERROR: Could not find a version that satisfies the requirement Django==1.10.5 from versions: none ERROR: No matching distribution found Django==1.10.5 错误:找不到满足要求 cv2 的版本(来自版本:无)错误:找不到 cv2 的匹配分发 - ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none) ERROR: No matching distribution found for cv2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM