无法安装django-constance,遇SSL证书验证及版本匹配错误
Looks like you're hitting a common issue with outdated pip versions not supporting modern TLS protocols. PyPI stopped accepting connections using TLSv1.0 and TLSv1.1 a while ago, which is why your install is failing with that SSL alert. Here's how to fix it:
Solution 1: Upgrade Pip First (Recommended)
The best long-term fix is to update your pip to a version that supports TLS 1.2+. Run this command:
pip3 install --upgrade pip
If this command also throws the same SSL error (since your current pip can't connect to PyPI securely), you can download the official get-pip.py script from the pip project's official sources, then run it with Python 3:
python3 get-pip.py
This will install the latest version of pip that supports modern TLS protocols. Once pip is updated, try installing django-constance again with pip3 install django-constance—it should work without issues.
Solution 2: Bypass SSL Verification Temporarily
If you can't upgrade pip right now, you can tell pip to trust PyPI's hosts during the install. This skips SSL verification for the package download:
pip3 install django-constance --trusted-host pypi.org --trusted-host files.pythonhosted.org
Note: This is a temporary workaround. Upgrading pip is still better for security and future package installs.
Why This Happens
Older versions of pip (prior to 9.0.1) don't support the TLS 1.2 protocol required by PyPI's current security standards. The error message [SSL: TLSV1_ALERT_PROTOCOL_VERSION] is PyPI's way of letting you know your connection is using an outdated, insecure protocol that's no longer allowed.
内容的提问来源于stack exchange,提问作者sof-03

