Skip to content

Commit 132ef4e

Browse files
committed
Disable user-site packages in pip environment
Set PYTHONNOUSERSITE=1 in pipEnv to prevent importing user-site packages (e.g. ~/.local/.../site-packages) that could shadow the bundled pip in the build Python. This change was added in src/serious_python/bin/package_command.dart alongside the existing PYTHONPATH handling.
1 parent 58b8bd5 commit 132ef4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/serious_python/bin/package_command.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ class PackageCommand extends Command {
321321
pipEnv = {
322322
"PYTHONPATH":
323323
[sitecustomizeDir.path].join(Platform.isWindows ? ";" : ":"),
324+
// Prevent importing user-site packages (e.g. ~/.local/.../site-packages)
325+
// which can shadow bundled pip in build Python.
326+
"PYTHONNOUSERSITE": "1",
324327
};
325328

326329
sitePackagesDir = arch.key.isNotEmpty

0 commit comments

Comments
 (0)