Where is the sys module located, or how to find it in Win 11 & Python

64 Views Asked by At

Does anyone know how to find where the sys module is installed in a Windows 11 install of anaconda3 & Python? I've tried looking in the Lib folder already and although there is a file called sys.py, it seems awfully short for the number of methods exported by sys. I also tried sys.__file__ with no luck, does anybody know how I can find this thing?

Tried sys.__file__ but it did not return a path, I also tried searching in the Lib folder of anaconda3 with no luck.

1

There are 1 best solutions below

2
ShadowRanger On

It's not installed anywhere, it's baked into the interpreter itself. The module contains functionality that core Python relies on, and can't function without, so it's not a separately loaded module at all, even though you import it like one.

It's not even in the normal Modules directory of the CPython source tree (where C extension module source code normally lives; Lib is for modules implemented in Python), it's in the Python directory (where the core interpreter source code lives).