catalina – Why is pip3 referencing Python 2 instead of 3?


When I try to install Python pacakges using pip3 on macOS (Catalina) it searches Python 2 instead:

vger:~(61)+>- sudo -H pip3 install xattr
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Requirement already satisfied: xattr in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (0.6.4)
vger:~(62)+>- which pip3
/usr/bin/pip3
vger:~(63)+>- file /usr/bin/pip3
/usr/bin/pip3: Mach-O 64-bit executable x86_64
vger:~(64)+>- which python3
/usr/bin/python3
vger:~(65)+>-

Which means of course that I can’t install extra packages on Python 3. Why is a utility dedicated to Python 3 accessing Python 2 paths?