Если поломался pip на macOS

Например, ругается на zlib, хотя он установлен:

      File "/usr/local/Cellar/python@3.7/3.7.9_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/distutils/command/build_ext.py", line 340, in run
        self.build_extensions()
      File "/private/var/folders/3r/04yr8dd57896ccmx1f86ptnr0000gn/T/pip-install-lmm5ssql/Pillow/setup.py", line 694, in build_extensions
        raise RequiredDependencyException(f)
    __main__.RequiredDependencyException: zlib

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3r/04yr8dd57896ccmx1f86ptnr0000gn/T/pip-install-lmm5ssql/Pillow/setup.py", line 918, in <module>
        raise RequiredDependencyException(msg)
    __main__.RequiredDependencyException:

    The headers or library files could not be found for zlib,
    a required dependency when compiling Pillow from source.

    Please see the install instructions at:
       https://pillow.readthedocs.io/en/latest/installation.html

То можно сделать следующее:

python3 -m pip install --user --force-reinstall pip

После этого у меня все установилось. Если не поможет - то можно понизить версию python через brew и не забывайте про brew doctor.

python