每个module都会有__file__
属性记录它的路径,以numpy为例
import numpy as np
import os
path = os.path.abspath(np.__file__)
Reference:
https://stackoverflow.com/questions/247770/how-to-retrieve-a-modules-path
汝等当勤精进。譬如小水长流,则能穿石
每个module都会有__file__
属性记录它的路径,以numpy为例
import numpy as np
import os
path = os.path.abspath(np.__file__)
Reference:
https://stackoverflow.com/questions/247770/how-to-retrieve-a-modules-path