3

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?

2 Answers 2

2

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'] >>> 
Sign up to request clarification or add additional context in comments.

Comments

0

PYTHONPATH is the default search path for importing modules. If you use bash, you could type echo $PYTHONPATH to look at it.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.