Python Library Path

后端 未结 3 932
栀梦
栀梦 2020-12-24 00:19

In ruby the library path is provided in $:, in perl it\'s in @INC - how do you get the list of paths that Python searches for modules when you do a

相关标签:
3条回答
  • 2020-12-24 00:35

    You can also make additions to this path with the PYTHONPATH environment variable at runtime, in addition to:

    import sys
    sys.path.append('/home/user/python-libs')
    
    0 讨论(0)
  • 2020-12-24 00:39

    I think you're looking for sys.path

    import sys
    print (sys.path)
    
    0 讨论(0)
  • 2020-12-24 00:47
    import sys
    sys.path
    
    0 讨论(0)
提交回复
热议问题