0
from typing import Self

ImportError of this code is: cannot import name 'Self' from 'typing'.

I had download a typing package in my pycharm, but didn't succeed. What should I do?

joel
  • 6,359
  • 2
  • 30
  • 55
  • 1
    you shouldn't need to download the `typing` package, it's part of the standard library. I don't know what you downloaded. Your problem is almost certainly that your python version doesn't have `Self` in `typing`. It might be in `typing_extensions`. If not, either use a newer python version or try the last bit of this answer https://stackoverflow.com/a/72182814/5986907 – joel Jan 21 '23 at 10:16
  • 1
    `typing.Self` only landed in python 3.11 through [PEP673](https://peps.python.org/pep-0673/), please check `python --version`. – ljmc Jan 21 '23 at 15:19

0 Answers0