1. 程式人生 > >python添加模塊搜索路徑

python添加模塊搜索路徑

16px inux dha append end linux python2.7 span margin

1.函數添加

  import sys sys.path

  sys.path.append("c:\\")

2.修改pythonpath(試不通)

  windows:PYTHONPATH

3.增加.pth文件(可以)

site-packages或者python安裝目錄添加 xx.pth,文件內容為模塊目錄。

linux(ubuntu) /usr/local/lib/python2.7/dist-packages

  linux(redhat) /usr/lib/python2.7/site-packages

轉:https://www.douban.com/note/334738164/

python添加模塊搜索路徑