Importing in Python

前端 未结 4 1528
南旧
南旧 2020-12-20 04:27

In Python 2.5, I import modules by changing environment variables. It works, but using site-packages does not. Is there another way to import modules in directories other

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-20 04:40

    sys.path is a list to which you can append custom paths to search like this:

    sys.path.append("/home/foo")
    

提交回复
热议问题