"Please upgrade python" 当我有 3.7 时 "Please upgrade pip" 当我有 20.0.2 时。为什么会出现此错误?
"Please upgrade python" when I have 3.7 and "Please upgrade pip" when I have 20.0.2. Why am I getting this error?
我想下载 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。但随后出现
$ 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 版本时,它显示了这个
$ 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
如何一劳永逸地解决这个问题?
因为python2不再支持,
Pip2(由 pip
或 python -m pip
调用)抱怨你应该使用 python 3. python 3 的包管理器称为 pip3(由 [=12= 调用] 或 python3 -m pip
).
您的pip3目前是最新版本,您无需采取任何措施升级pip3。
如果您想在 python 中使用 PIL,那么我推荐您 install pillow。 Pillow是python3的PIL。
您应该可以使用 pip3 install Pillow
安装 pillow。枕头取代 PIL。 (除非您特别想将 PIL 与 python 2 一起使用)
也许您想将终端配置为将 pip 别名为 pip3,这样您就不会错误地调用 pip2。
我想下载 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。但随后出现
$ 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 版本时,它显示了这个
$ 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
如何一劳永逸地解决这个问题?
因为python2不再支持,
Pip2(由 pip
或 python -m pip
调用)抱怨你应该使用 python 3. python 3 的包管理器称为 pip3(由 [=12= 调用] 或 python3 -m pip
).
您的pip3目前是最新版本,您无需采取任何措施升级pip3。
如果您想在 python 中使用 PIL,那么我推荐您 install pillow。 Pillow是python3的PIL。
您应该可以使用 pip3 install Pillow
安装 pillow。枕头取代 PIL。 (除非您特别想将 PIL 与 python 2 一起使用)
也许您想将终端配置为将 pip 别名为 pip3,这样您就不会错误地调用 pip2。