Я хотел загрузить библиотеку PIL для обрезки изображений на python, но я просто не могу загрузить модуль. Вот что появляется на терминале
$ pip install PIL
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. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
Тогда я попробовал это. Но появляется другая ошибка
$ python3 -m pip install PIL
Could not find a version that satisfies the requirement PIL (from versions: )
No matching distribution found for PIL
You are using pip version 10.0.1, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Поэтому я попытался обновить свой пункт. Но тогда это показывает
$ pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-20.0.2-py2.7.egg (20.0.2)
Когда я проверяю свою версию в пипсах, она показывает
$ pip --version
pip 20.0.2 from /Library/Python/2.7/site-packages/pip-20.0.2-py2.7.egg/pip (python 2.7)
Когда я проверяю свою python версию, она показывает
$ python --version
Python 2.7.10
$ python3 --version
Python 3.7.1
Итак, я скачал pip3 и затем попробовал команду
$ pip3 install PIL
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
Я также попробовал то, что они сказали.
$ python3 -m pip3 install PIL
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3: No module named pip3
Вот некоторые подробности о моем pip и python
$ which pip3
/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3
$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Как мне решить это раз и навсегда?