Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Library Path

Tags:

python

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 an import?

like image 640
Kyle Burton Avatar asked Sep 25 '08 18:09

Kyle Burton


2 Answers

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') 
like image 131
apg Avatar answered Sep 17 '22 12:09

apg


I think you're looking for sys.path

import sys print (sys.path) 
like image 23
Jack M. Avatar answered Sep 18 '22 12:09

Jack M.