![](/img/trans.png)
[英]ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
[英]ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none) ERROR: No matching distribution found for tensorflow)
我想安装 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
错误是在运行代码时:
No module named '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版本为19.3,python版本为3.7
在Windows 上,您必须使用Python 3.7.6(64 位)来安装tensorflow :
C:\Program Files\Python-3.7.6-x64> python.exe -m pip install --user tensorflow
不幸的是,tensorflow 不支持 32 位版本,并且会给您带来令人讨厌的错误:
找不到满足 tensorflow 要求的版本(来自版本:无)错误:未找到 tensorflow 的匹配分布
几个重要的注意事项:
C:\\Users\\karlphillip\\AppData\\Roaming\\Python\\Python37\\site-packages
。python -m pip install --user --upgrade pip
.python -m pip install --user tensorflow
解决方案
我发现问题出在 Python 版本上。
所以我将Python版本从3.8.1降级到3.7.6后来我工作正常
pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl
我的系统规格
对于遇到此问题的其他人,TensorFlow 可能还不支持您正在运行的版本。 在撰写本文时,您在运行 Python 3.9 并尝试安装 TensorFlow 时会遇到相同的错误。 您需要确保 TensorFlow 支持您的 Python 版本。
https://www.tensorflow.org/install/
TensorFlow 在以下 64 位系统上经过测试和支持:
- Python 3.5–3.8
然后我使用了不同的 python。 即python3.8 -m pip install tensorflow==2.3.0
嗨,在这里写下我的建议,因为我还不能发表评论。
您能否尝试查看是否安装了正确的 python 版本? 有时出现问题并安装了 32 位版本的 python。 但是 tensorflow 仅适用于 python 的 64 位版本。 您可以使用以下命令在 python 解释器中检查您的 python 版本
import struct
print struct.calcsize("P") * 8
它应该打印“64”。
一般似乎 python 3.7 和 tensorflow 有问题(这里)
对于那里的某些人来说,它有助于安装特定的 tensorflow 版本
pip install tensorflow==1.14.0
一个解决方案可能是降级到 phyton 3.6。
对于 3.6:另一种可能的解决方案可以在此线程中找到(对于 Windows 仅适用于 Python 3.6 截至本答案日期)
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
我希望这有助于解决您的问题。
这个解决方案一直对我有用。
1)弄清楚你实际使用的是什么 Python 解释器
import sys
print(sys.executable) #prints "path_to_python"
2)在终端运行: "path_to_python" -m pip install tensorflow
其中"path_to_python"
显然是你之前得到的 output。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.