Consider the following:
$ docker run --rm -it python bash root@d1fea8455a6b:/# /usr/bin/python3 -c "from sys import path; print(path)" ['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/dist-packages', '/usr/lib/python3/dist-packages'] root@d1fea8455a6b:/# /usr/local/bin/python3 -c "from sys import path; print(path)" ['', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/usr/local/lib/python3.9/site-packages']
There are two different pythons installed, in
/usr/local/bin/python3, which look for their packages in two different directories (
/usr/local/lib/... respectively). This has caused a bug for me because I built an image based off of the python image, which installed a bunch of stuff in
/usr/local/lib/, but it breaks if the user of my image accidentally uses the
I can work around this by getting rid of the
/usr/bin/python3*, but why does this exist in the first place?