ImportError: cannot import name ‘OrderedDict‘ from ‘typing‘ (D:\environment\Anaconda\envs\DROID\lib\

一、报错情况

在anaconda中创建了新环境,然后使用如下代码安装了TensorFlow 2.0和Sonnet 2。

pip install tensorflow tensorflow-probability
pip install dm-sonnet

然后在pycharm中使用代码测试是否安装成功

import tensorflow as tf
import sonnet as snt

print("TensorFlow version {}".format(tf.__version__))
print("Sonnet version {}".format(snt.__version__))

结果报错如下:
在这里插入图片描述

二、问题根源

Anaconda中环境指定的python3.7.0不行!!!!

根源在于anaconda中的环境的python版本不适配,我新建的anaconda的新环境指定的python版本是3.7.0,至少是3.7.2才行!

三、解决方法

(1)打开Anaconda Prompt

在这里插入图片描述

(2)更新指定环境的python版本

conda install python==3.7.2 -n 要更新环境的名字

在这里插入图片描述
在这里插入图片描述

(3)重新run

在这里插入图片描述

四、撒花撒花…

猜你喜欢

转载自blog.csdn.net/Elon15/article/details/129710215