【python】sys.path


上篇博客将bug--lost  sys.stdout时涉及了sys.path,上网看了几篇关于sys.path,做个简单的记录

sys.path是python的搜索模块的路径集,是一个list

可以在python环境下使用:

sys.path.append(‘你的模块的名称’)
sys.path.insert(0,’模块的名称’)

添加相关的路径,但在退出python环境后自己添加的路径就会自动消失!

详细见

python文档:  https://docs.python.org/3.8/using/cmdline.html

Python sys.path详细介绍 :

在Python中以绝对路径或者相对路径导入文件的方法: https://blog.csdn.net/xiongchengluo1129/article/details/80453599