Open sirianni opened 1 year ago
$ asdf install python 3.8.14 python-build 3.8.14 /home/sirianni/.asdf/installs/python/3.8.14 Downloading Python-3.8.14.tar.xz... -> https://www.python.org/ftp/python/3.8.14/Python-3.8.14.tar.xz Installing Python-3.8.14... Installed Python-3.8.14 to /home/sirianni/.asdf/installs/python/3.8.14
$ /home/sirianni/.asdf/installs/python/3.8.14/bin/python -c 'import sys; print("\n".join(sys.path));' /home/sirianni/.asdf/installs/python/3.8.14/lib/python38.zip /home/sirianni/.asdf/installs/python/3.8.14/lib/python3.8 /home/sirianni/.asdf/installs/python/3.8.14/lib/python3.8/lib-dynload /home/sirianni/.local/lib/python3.8/site-packages /home/sirianni/.asdf/installs/python/3.8.14/lib/python3.8/site-packages
Note that sys.path incorrectly includes /home/sirianni/.local/lib/python3.8/site-packages which is from the system python installation.
sys.path
/home/sirianni/.local/lib/python3.8/site-packages
It seems that python's site.py will dynamically add ~/.local/lib/... to sys.path if there is a matching python version. This can be disabled by setting the environment variable PYTHONNOUSERSITE=1.
site.py
~/.local/lib/...
PYTHONNOUSERSITE=1
Note that
sys.path
incorrectly includes/home/sirianni/.local/lib/python3.8/site-packages
which is from the system python installation.