You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial `import site` loads the Python standard library module `site`, which sets up the library paths.
68
+
To do so, it uses the path of the currently running Python executable.
69
+
For a language like Python, which is built around the filesystem, this makes sense, but in our Java embedding context, we do not have a Python executable running.
70
+
This is what the `python.Executable` option is for: it reports which executable _would be_ running if we were running Python directly inside our venv.
71
+
That is enough to make the machinery work and any packages inside the venv available to the embedded Python in Java.
72
+
73
+
A simple venv is already quite heavy, because it comes with the machinery to install more packages.
74
+
For a Java distribution, we can strip the venv down somewhat without much trouble.
75
+
Just run these inside the top-level venv directory:
76
+
```shell
77
+
find . -type d -name "__pycache__" -exec rm -rf "{}"";"
78
+
rmdir include
79
+
rm bin/*
80
+
rmdir bin
81
+
rm lib/python3.*/site-packages/easy_install.py
82
+
rm -rf lib/python3.*/site-packages/pip*
83
+
```
84
+
85
+
Some packages may require the following, but most do not, so you can also remove these, but be aware that it _may_ break a few packages:
0 commit comments