有时我们需要动态的确定当前采用的Python运行时环境对应的site-packages目录,在Python代码中,可以这样做:from distutils.sysconfig import get_python_libprint get_python_lib()备忘。