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

安装gensim后导入出现CryptographyDeprecationWarning警告的解决办法

解决Gensim导入时的CryptographyDeprecationWarning警告

这个警告是因为Gensim依赖的组件中使用了已被cryptography库弃用的Blowfish算法,以下是几种解决办法:

  • 升级Gensim到最新版本
    官方后续版本大概率会修复这个依赖问题,执行命令更新:
    pip install --upgrade gensim

  • 升级cryptography库
    部分情况下,更新cryptography到兼容版本也能解决警告,执行:
    pip install --upgrade cryptography

  • 临时抑制警告(不影响功能时使用)
    如果升级后警告仍存在,且不影响代码运行,可以在导入Gensim前添加代码屏蔽特定警告:

    import warnings
    from cryptography.utils import CryptographyDeprecationWarning
    
    warnings.filterwarnings("ignore", category=CryptographyDeprecationWarning)
    import gensim
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 15:57:02