本文主要介绍Python中,通过执行python3 -m pip install --upgrade pip命令升级pip时,报错:WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>的解决方法及示例代码。

报错信息:

python3 -m pip install --upgrade pip
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/include/python3.9/UNKNOWN
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
WARNING: Value for scheme.scripts does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/bin
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin
WARNING: Value for scheme.data does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None
Requirement already satisfied: pip in /opt/homebrew/lib/python3.9/site-packages (21.1)
WARNING: Value for scheme.platlib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.purelib does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/lib/python3.9/site-packages
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
WARNING: Value for scheme.headers does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/include/python3.9/UNKNOWN
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9
WARNING: Value for scheme.scripts does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew/bin
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/bin
WARNING: Value for scheme.data does not match. Please report this to <https://github.com/pypa/pip/issues/9617>
distutils: /opt/homebrew
sysconfig: /opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9
WARNING: Additional context:
user = False
home = None
root = None
prefix = None

解决方法:

这个报错是一个警告,也不会影响任何安装逻辑。可以安全地使用当前pip,暂时忽略此警告。

如果想要消除此警告,可以尝试升级指定版本。

python -m pip install pip==21.0.1

或者,尝试在虚拟环境中升极

python3 -m venv venv
source ./venv/bin/activate
pip install --upgrade pip

推荐文档