How to refresh sys.path?

前端 未结 2 1078
夕颜
夕颜 2020-12-16 16:22

I\'ve installed some packages during the execution of my script as a user. Those packages were the first user packages, so python didn\'t add ~/.local/lib/python2.7/si

2条回答
  •  死守一世寂寞
    2020-12-16 16:31

    It might be better to add it directly to your sys.path with:

    import sys
    sys.path.append("/your/new/path")
    

    Or, if it needs to be found first:

    import sys
    sys.path.insert(1, "/your/new/path")
    

提交回复
热议问题