![]() |
VOOZH | about |
Sys is a built-in Python module that contains parameters specific to the system i.e. it contains variables and methods that interact with the interpreter and are also governed by it.
sys.path is a built-in variable within the sys module. It contains a list of directories that the interpreter will search in for the required module.
When a module(a module is a python file) is imported within a Python file, the interpreter first searches for the specified module among its built-in modules. If not found it looks through the list of directories(a directory is a folder that contains related modules) defined by sys.path.
There are three ways to specify a path :
Output:
👁 ImagePYTHONPATH=C:\Users\Vanshi\Desktop
Output:
👁 ImageOutput:
👁 ImageNote that the first string returned by path is always empty this is to indicate the interpreter to check in the current directory.