You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Mac使用pip时持续出现SSL错误,重装系统及关防火墙无效求解决

Fixing Persistent pip SSL Error on macOS

Hey Sean, I feel your frustration—dealing with persistent SSL errors on pip even after reinstalling macOS and turning off the firewall is no fun. Let's walk through some targeted fixes that should help you get past this:

  • Upgrade pip using curl (bypass SSL for the upgrade)
    Since the SSL error is blocking pip itself from updating, use curl to grab the official get-pip script and run it directly. This skips pip's broken SSL check temporarily to get you the latest version, which often fixes outdated TLS protocol issues:

    curl https://bootstrap.pypa.io/get-pip.py | python3
    
  • Force pip to use trusted hosts
    PyPI requires modern TLS connections, and older pip versions might struggle with certificate verification. Try running your install command with explicit trusted host flags:

    pip3 install discord.py --trusted-host pypi.org --trusted-host files.pythonhosted.org
    

    As a temporary workaround, you can also disable SSL verification entirely (use this only until you fix the root issue):

    export PYTHONHTTPSVERIFY=0
    pip3 install discord.py
    
  • Check your system's SSL certificates
    macOS relies on Keychain Access for trusted root certificates. Open Keychain Access, navigate to System > Certificates, and make sure you have up-to-date root certs like DigiCert Global Root CA and ISRG Root X1. If any are missing or expired:

    1. Go to Keychain Access > Certificate Assistant > Get a Certificate From a Certificate Authority
    2. Follow the prompts to refresh your root certificates, or manually install any missing ones from Apple's official certificate repository.
  • Look for hidden network proxies
    Even with the firewall off, leftover proxy settings (from a VPN, corporate network, or old configuration) can mess with SSL connections. Check for active proxies on your Wi-Fi (or Ethernet) interface:

    networksetup -getwebproxy Wi-Fi
    networksetup -getsecurewebproxy Wi-Fi
    

    If you see any enabled proxies, turn them off with:

    networksetup -setwebproxystate Wi-Fi off
    networksetup -setsecurewebproxystate Wi-Fi off
    
  • Reinstall Python from the official source
    The default Python bundled with macOS sometimes uses outdated SSL libraries. Download the latest Python version from python.org, run the installer, and make sure it updates your system PATH so you're using the new python3 and pip3 instead of the system defaults. Verify this after installation:

    which python3
    which pip3
    

    You should see paths pointing to /Library/Frameworks/Python.framework/Versions/X.X/bin/ (not /usr/bin/).

内容的提问来源于stack exchange,提问作者Sean Hatch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:59:30