Analyze the directory structure differences of a virtual environment between Windows and POSIX (Linux/Mac). Where do the executables live?
Python interview question for Advanced practice.
Answer
Venvs follow host OS conventions. On POSIX (Linux/macOS), binaries live in bin/ and libraries in lib/pythonX.Y/site-packages/. On Windows, binaries live in Scripts/ and libraries in Libsite-packages. This is a friction point for cross-platform scripts (e.g., Makefiles). Robust systems use 'python -m' to avoid path dependencies or check the OS environment variable to resolve paths.
Explanation
This difference forces cross-platform automation tools to include OS-detection logic.