[英]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:几个重要的注意事项:
C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages
.C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages
。python -m pip install --user --upgrade pip
. python -m pip install --user --upgrade pip
.python -m pip install --user tensorflow
python -m pip install --user tensorflow
Solution
解决方案
I figured out that the issue is with the Python version.我发现问题出在 Python 版本上。
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
我的系统规格
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.0
即
python3.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
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.