简体   繁体   English

如何解决有关 TensorFlow 环境的错误?

[英]How can I solve this error about TensorFlow environment?

I have met the error as follows when I run some code of TFF:我在运行TFF的一些代码时遇到如下错误:

my code:我的代码:

!pip install --quiet --upgrade tensorflow_federated

import collections
import numpy as np
import tensorflow as tf
import tensorflow_federated as tff

tf.compat.v1.enable_v2_behavior()

my Error:我的错误:

ImportError: This version of TensorFlow Addons requires TensorFlow 
version >= 2.1.0; Detected an installation of version 1.15.0. Please upgrade 
TensorFlow to proceed.

My try:我的尝试:

I have tried to upgrade tensorflow to 2.1.0 but the same error appeared.我尝试将 tensorflow 升级到 2.1.0,但出现了同样的错误。 And then I uninstall tensorflow and install it again, but there is no change with error output.然后我卸载tensorflow并重新安装,但错误output没有变化。

pip install --upgrade tensorflow

升级 TensorFlow 并重试

尝试这个

python -m pip install --upgrade tensorflow

I ran into the same issue this morning.今天早上我遇到了同样的问题。

What fixed it for me was uninstalling then re installing both tensorflow and the tensorflow-addons package.对我来说修复它的是卸载然后重新安装 tensorflow 和 tensorflow-addons 包。 Give that a try:试试看:

pip uninstall tensorflow-addons
pip uninstall tensorflow

pip install tensorflow
pip install tensorflow-addons

uninstall version卸载版本

!pip uninstall tensorflow

install latest version安装最新版本

!pip install tensorflow==1.15.2

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM