#interviewQuestions : 0012
What is PYTHONPATH?
What is PYTHONPATH?
PYTHONPATH is an environment variable can be set, to add additional directories where python will look for modules and packages.
Whenever a module is imported, PYTHONPATH is also looked up to check for the presence of the imported modules in various directories. The interpreter uses it to determine which module to load.
For most installations, you should not set these variables since they are not needed for Python to run. Python knows where to find its standard library.
The only reason to set PYTHONPATH is to maintain directories of custom Python libraries that you do not want to install in the global default location (i.e., the site-packages directory).
#interviewQuestions : 0013
What are python modules?
What are python modules?
Python modules are files containing Python code.
A module can define functions, classes and variables. A module can also include runnable code. Grouping related code into a module makes the code easier to understand and use.