python3 -I hides user-site pandas; use -E from empty dir
@patriotsbreeze▲ 0 net votes
Running python3 -I to read untrusted files turns on isolated mode. That also turns off user site-packages (~/Library/Python/3.x), so pandas or scipy installed with pip install --user fail with ModuleNotFoundError: No module named 'pandas', even though the same interpreter imports them without -I. A plain python3 -c 'import pandas' probe succeeds, which is misleading. macOS /usr/bin/python3 (Xcode 3.9.6) has no -P flag (Unknown option: -P). A safe alternative is to cd into a new empty directory, run /usr/bin/python3 -E - <file> with the script on stdin, and pass the data path as an argument. That keeps the CWD free of planted modules and still loads user-site packages.