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

pip安装报错WinError 10061及usaddress本地安装异常求助

解决pip安装含额外数据包(如usaddress)的防火墙相关报错

Hey there, let's work through this pip installation headache you're dealing with—especially tricky when packages like usaddress need to pull extra data, and firewalls are blocking the way. Here are some targeted fixes to try:

  • 配置pip代理(适配企业防火墙)
    如果你的网络是通过企业代理访问外部资源,先给pip配置代理:

    • 临时使用代理安装:
      pip install usaddress --proxy http://your-proxy-server:port
      
      若代理需要认证,格式为 http://username:password@your-proxy-server:port(注意:不要在公共环境中明文输入密码,可考虑使用环境变量存储敏感信息)
    • 永久配置代理:
      创建或修改pip的配置文件:
      • Linux/macOS:~/.config/pip/pip.conf
      • Windows:%APPDATA%\pip\pip.ini
        在文件中添加:
      [global]
      proxy = http://your-proxy-server:port
      
  • 使用镜像源绕过直接访问限制
    国内的PyPI镜像源(如清华镜像)通常缓存了包的完整依赖数据,包括usaddress需要的额外训练模型:

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

    这个方法能避免直接访问官方的数据源,大概率绕过防火墙的拦截。

  • 手动下载额外数据后本地安装
    如果本地安装whl/tar包时提示缺少数据,你可以手动提前准备好这些文件:

    1. 找到usaddress需要的额外数据URL(通常可以在包的GitHub仓库或setup.py文件中找到,比如usaddress的训练数据URL)
    2. 手动下载数据文件,放到pip安装时默认查找的路径:
      • Linux/macOS:~/.local/share/usaddress/
      • Windows:%LOCALAPPDATA%\usaddress\
    3. 再执行本地安装命令:
      pip install /path/to/usaddress.whl
      

    确保文件名和路径完全匹配包的预期,否则安装时还是会报错。

  • 验证防火墙拦截范围
    先确认防火墙到底拦截了哪些请求:

    • 测试能否访问PyPI:curl https://pypi.org/simple/usaddress/
    • 测试能否访问usaddress的数据源URL:curl [数据文件的URL]
      如果这两个请求都失败,说明防火墙确实拦截了这些域名/IP,需要联系IT部门申请开放对应的访问权限。
  • 用虚拟环境隔离安装环境
    有时候系统级的pip配置冲突会导致奇怪的报错,试试在虚拟环境中安装:

    # 创建虚拟环境
    python -m venv my_usaddress_env
    # 激活虚拟环境(Linux/macOS)
    source my_usaddress_env/bin/activate
    # 激活虚拟环境(Windows)
    my_usaddress_env\Scripts\activate
    # 带代理安装(如果需要)
    pip install usaddress --proxy http://your-proxy-server:port
    

Hope one of these fixes gets you past those Error 1 and Error 2 issues smoothly!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.25 07:28:42