简介:解决 module ‘tensorflow‘ has no attribute ‘compat‘问题(有Tensorflow降版本 详细过程)
解决 module ‘tensorflow‘ has no attribute ‘compat‘问题(有Tensorflow降版本 详细过程)
在Tensorflow中,如果遇到”module ‘tensorflow’ has no attribute ‘compat’”的问题,这通常是因为Tensorflow的版本过高,而你的代码或环境不支持这个版本。为了解决这个问题,你可以考虑将Tensorflow版本降低到一个你的环境和代码可以支持的版本。
首先,你需要知道你的Python环境以及你的Tensorflow版本。你可以通过以下命令来查看:
python --versionpip show tensorflow
如果你的Tensorflow版本过高,那么你可能需要降级到一个更低的版本。以下是如何做到这一点的步骤:
pip uninstall tensorflow
注意:在执行上述命令之前,你可能需要更新你的pip版本。你可以通过以下命令来完成:
pip install tensorflow==1.15
在安装了较低版本的Tensorflow之后,你应该能够解决”module ‘tensorflow’ has no attribute ‘compat’”的问题。如果你的问题仍然存在,那可能是因为其他的原因。在这种情况下,你可能需要进一步检查你的代码和环境。
pip install --upgrade pip