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.
If you mean Path
in standard library, use pathlib.Path
, not path.Path
.
>>> from pathlib import Path
>>> Path
<class 'pathlib.Path'>
这应该这样做:
sudo pip install path.py
Depending on your needs, also
from os import path
works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.