ImportError: No module named path

14,197

Solution 1

If you mean Path in standard library, use pathlib.Path, not path.Path.

>>> from pathlib import Path
>>> Path
<class 'pathlib.Path'>

Solution 2

This should do it:

sudo pip install path.py
Share:
14,197
仲耀晖
Author by

仲耀晖

Updated on June 07, 2022

Comments

  • 仲耀晖
    仲耀晖 almost 2 years

    I have this line in my script:

    from path import Path
    

    but I ran into this error

    ImportError: No module named path
    

    however, I have install path.py in my system, there is no problem when I write in python3 with from path import Path in terminal. this is very weird.