sys module
The standard library module through which a program asks the running interpreter about itself.
In more detail
sys.version_info gives the version, sys.executable the interpreter file, sys.path the module search path, sys.prefix the installation, and sys.argv the command-line arguments. sys.exit ends the program with an exit code.
Related terms
- sys.version_info — A value in the sys module that tells a running program exactly which Python version it is, as major, minor and micro numbers.
- sys.executable — The full path of the Python interpreter file that is running the current program.
- module search path — The list of folders Python searches, in order, when a program imports a module.
- sys.prefix — The folder a running Python treats as its installation; inside a virtual environment it differs from sys.base_prefix.
Taught in
- What Python Is, And Where It Came From — Hands-on Python: Complete Video Course & Book
- Installing Python On A Mac — Hands-on Python: Complete Video Course & Book
- Installing Python On Linux — Hands-on Python: Complete Video Course & Book
- Where Python Lives: PATH And Versions — Hands-on Python: Complete Video Course & Book
- Virtual Environments — Hands-on Python: Complete Video Course & Book
- Print, Input And The Casts Between — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Try, Except, Else And Finally — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Import Variants, dir() And sys.path — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Your Own Modules And Packages — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Modules Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Generators And Iterators — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Streams, Handles And Open Modes — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep