An import error, confusing! run python pandas\util\_print_versions.py get ModuleNotFoundError: No module named 'pandas'
There's something I do not understand. Please try to straightly run pandas\util_print_versions.py and you may see this error.
Codes in that file look like:
from __future__ import annotations import numpy as np import pandas as pd ... if __name__ == "__main__": ...
I just cannot understand why these codes are like this. Straightly run this file will report:
Traceback (most recent call last): File "xxx\python\Lib\site-packages\pandas\util\_print_versions.py", line 11, in <module> from pandas._typing import JSONSerializable ModuleNotFoundError: No module named 'pandas'
I just cannot understand how could it run! You can find these kinds almost anywhere!
Another example is from one of my friend's codes:
The project folder looks like:
├─xxx ├─yyy ├─core │ ├─aaa │ └─HHH ├─zzz ├─main.py
And in HHH, he wrote this:
from core.aaa import bbb ... if __name__ == '__main__': ...
He told me that he can run HHH with no error on PyCharm! And that is forbidden in VScode!
Is there anyone can tell me what the f*** is going on?