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

Mac OS X系统pip与pip3安装Python库失败问题求助

Fixing Sudden pip SSL Certificate Issues When Installing Python Packages

Hey there, let's tackle this unexpected SSL certificate problem with pip that you've been facing lately. It's super frustrating when something that worked fine suddenly breaks, so let's walk through practical fixes that often resolve this kind of issue:

  • Check and refresh your system's SSL root certificates
    Sudden SSL errors often stem from outdated or corrupted system root certificates. Here's how to fix this on common operating systems:

    • For Debian/Ubuntu-based Linux:
      sudo apt-get update && sudo apt-get install --reinstall ca-certificates
      
    • For CentOS/RHEL-based Linux:
      sudo yum reinstall ca-certificates
      
    • For Windows: Go to Internet Options > Content > Certificates > Trusted Root Certification Authorities and click "Update" to refresh your system's root certificates.
  • Force pip to use your system's SSL certificates
    Sometimes pip relies on its own cached certificates which might be broken. You can tell it to use your system's valid certificates instead:

    • On Linux/macOS, set this environment variable first:
      export PIP_CERT=/etc/ssl/certs/ca-certificates.crt
      
    • On Windows, set the variable to your system's root certificate path (adjust the path if needed):
      set PIP_CERT=C:\Windows\System32\certificates\root\ca.pem
      

    Then try installing your package again:

    pip install pycoin
    
  • Test with an HTTP-based PyPI mirror (temporary workaround)
    To confirm the issue is indeed SSL-related, you can use a trusted HTTP mirror to bypass SSL verification temporarily. For example:

    pip install pycoin -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
    

    If this works, it confirms the problem is with SSL certificate validation—focus on fixing the root certificate issues above instead of using HTTP long-term (it's less secure).

  • Rule out network interference (proxies/firewalls)
    Have you changed networks recently, or did your company/home firewall/proxy get updated? Try these steps:

    • Disable any active proxies temporarily and retry the install.
    • If you need a proxy to access the internet, configure pip to use it explicitly:
      pip install pycoin --proxy http://your-proxy-address:port
      
    • Test connecting via a mobile hotspot to eliminate local network restrictions.

If none of the above works, consider reinstalling Python entirely—make sure to check the "Add Python to PATH" option during installation and ensure SSL components are included in the setup.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 06:15:34