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

macOSX(Python2.7.10)用pip9.0.1安装库遇连接错误求助

Fixing Pip Connection Refused Error (Errno 61) on macOS X Python 2.7.10

Hey there, let's work through that frustrating connection error you're hitting when trying to install Flask with pip 9.0.1. That Errno 61: Connection refused message typically means pip can't reach PyPI's default servers—and with older versions of pip/Python, this is pretty common due to network restrictions, outdated HTTPS support, or regional blocks.

Here are the most reliable fixes to try:

  • Test your network access to PyPI first
    Run this command in your terminal to check if you can reach the Flask package index directly:

    curl https://pypi.org/simple/flask/
    

    If you get a connection error here too, your issue is likely a network firewall, proxy requirement, or regional block. If it loads fine, the problem is specific to pip's configuration.

  • Use a domestic PyPI mirror temporarily
    Older pip versions often struggle with the default PyPI server's HTTPS setup. Try installing Flask using a trusted mirror instead:

    pip install flask -i https://pypi.tuna.tsinghua.edu.cn/simple
    

    This bypasses the default server and uses a faster, more accessible mirror for many regions.

  • Set up the mirror permanently (for future installs)
    To avoid typing the mirror URL every time, create a pip config file:

    1. Make the .pip directory in your home folder if it doesn't exist:
      mkdir -p ~/.pip
      
    2. Create or edit ~/.pip/pip.conf with this content:
      [global]
      index-url = https://pypi.tuna.tsinghua.edu.cn/simple
      

    Now all pip installs will use this mirror by default.

  • Upgrade pip to the latest compatible version
    Pip 9.0.1 is pretty old, and newer versions have better network handling (even for Python 2.7). Since Python 2.7 is end-of-life, the last pip version that supports it is 20.3.4. Upgrade with:

    pip install --upgrade pip==20.3.4
    

    After upgrading, try installing Flask again with the regular pip install flask command.

  • Check for proxy settings
    If your network requires a proxy to access external sites, you need to tell pip about it. Install Flask with your proxy details:

    pip install flask --proxy http://your-proxy-address:port
    

    For permanent proxy setup, add these lines to your ~/.pip/pip.conf:

    [global]
    proxy = http://your-proxy-address:port
    

A quick note: Python 2.7 has been officially unsupported since 2020, so if you have the option, consider migrating to Python 3.x for better security and package support. But if you're stuck with 2.7 for now, the above steps should get you past the connection error.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 06:51:01