Reputation: 221
What is the $PYTHONPATH variable, and what's the significance in setting it?
Also, if I want to know the content of my current pythonpath, how do I find that out?
Upvotes: 3
Views: 489
Reputation: 22438
As already answered PYTHONPATH is the search path used by python to find modules when you ''import' them.
Echoing $PYTHONPATH is only useful if you have set it.
However in python itself you can list out what it thinks it is.
$ python3
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-x86_64-linux-gnu', '/usr/lib/python3.4/lib-dynload', '/usr/local/lib/python3.4/dist-packages', '/usr/lib/python3/dist-packages']
>>>
Upvotes: 2
Reputation: 1
PYTHONPATH
is the default search path for importing modules. If you use bash, you could type echo $PYTHONPATH
to look at it.
Upvotes: 0