Skip to content

Recent macOS breaks access to (documented) environment variables #143565

@gav451

Description

@gav451

Bug report

Bug description:

On recent versions of macOS user defined environment variables (also those documented at https://docs.python.org/3/using/cmdline.html#environment-variables like PYTHONHOME) are not known in Python on recent versions of macOS (I have tested it on Tahoe 26.2 where they are not known and Big Sur 11.7.1 where they are known). For instance after setting
PYTHONPLATLIBDIR=lib
in the shell and typing in a Python interpreter

import os
os.getenv("PYTHONPLATLIBDIR")

returns an empty string on recent versions of macOS.

CPython versions tested on:

3.14, 3.9

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macextension-modulesC modules in the Modules dirpendingThe issue will be closed if no feedback is providedtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions