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

导入googletrans Translator模块遇httpcore属性错误,3.0版本仍报错求助

解决googletrans导入Translator时的httpcore错误
  • 完全卸载现有相关包,避免依赖冲突:
    pip uninstall -y googletrans httpcore httpx
    
  • 安装与googletrans 4.0.0rc1兼容的依赖版本:
    pip install googletrans==4.0.0-rc1 httpcore==0.15.0 httpx==0.23.0
    
    注:httpcore 0.15.x版本包含UnsupportedProtocol属性,和googletrans 4.0.0rc1匹配度较高
  • 若坚持使用3.0版本,执行以下清理后重新安装对应兼容依赖:
    pip uninstall -y googletrans httpcore httpx
    pip install googletrans==3.0.0 httpcore==0.14.7 httpx==0.22.0
    
  • 验证修复效果:
    在Python环境中运行以下代码测试:
    from googletrans import Translator
    translator = Translator()
    print(translator.translate('Hello', dest='zh-CN'))
    
    能正常输出翻译结果即为修复成功

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 13:42:02