将Python程序模块化执行python -m

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010412858/article/details/81515081

python folder/test.py
python -m folder.test

不同的加载py文件的方式,主要是影响sys.path这个属性。sys.path相当于Linux中的PATH
这就是当前Python解析器运行的环境,Python解析器会在这些目录下去寻找依赖库。

充分理解 python -m mod
https://blog.csdn.net/zelinhehe/article/details/79631198

猜你喜欢

转载自blog.csdn.net/u010412858/article/details/81515081
M
^M