cannot import name 'OrderedDict' from 'typing' (C:\ANACONDA\lib\typing.py)
时间: 2024-04-20 17:06:36 浏览: 204
typing_extensions.py
5星 · 资源好评率100%
This error message occurs when you are trying to import the `OrderedDict` class from the `typing` module but it is not available in the version of Python you are using.
The `OrderedDict` class was introduced in Python 2.7 and is available in Python 3.x as well. It is used to create dictionaries that maintain the order in which the keys are added.
To fix this error, you can use the `collections` module instead of the `typing` module to import the `OrderedDict` class:
```python
from collections import OrderedDict
```
This will import the `OrderedDict` class from the `collections` module and you can use it in your code.
阅读全文