每个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