简介:在Python的pip工具中,下载扩展包时出现'ValueError: check_hostname requires server_hostname'的错误,可能是由于pip的SSL验证出现问题。这个错误可能是由于你的环境变量中的证书或密钥无效或者不存在所引起的。
以下是几种可能的解决方案:
pip install --upgrade pip
请将’
pip install <package-name> --trusted-host pypi.org --trusted-host files.pythonhosted.org
请将’
pip config set global.cert <path-to-cert>pip config set global.trusted-host <domain>
pip config set global.cert /path/to/mycert.pempip config set global.trusted-host pypi.org
请将’
pip config set global.proxy <proxy-url>pip config set global.http-proxy <http-proxy-url>pip config set global.https-proxy <https-proxy-url>
以上就是解决pip下载扩展包时报错’ValueError: check_hostname requires server_hostname’的方法。如果这些方法都不能解决你的问题,你可能需要检查你的网络环境或者联系你的网络管理员。
pip config set global.proxy http://proxy.example.com:8080/pip config set global.http-proxy http://proxy.example.com:8080/pip config set global.https-proxy http://proxy.example.com:8080/