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

编译Java-CEF执行CMake命令遇'six.moves'模块找不到错误求助

解决Java CEF编译时ModuleNotFoundError: No module named 'six.moves'错误

问题场景

执行CMAKE -G "Visual Studio 17" -A x64 ..编译Java CEF时,触发clang-format下载流程失败,报错核心信息:

-- Downloading clang-format from Google Storage...
Failed to fetch file gs://chromium-clang-format/66882fadbf9e99cc00b8677d8c1e7e8b3cfdf4fe 
...
ModuleNotFoundError: No module named 'six.moves'

已尝试升级pip、重装six、在download_from_google_storage.py中添加import six,但问题未解决。

有效解决方案

1. 确认CMake使用的Python环境与six安装环境一致

  • 检查系统默认Python路径:执行where python(Windows),查看输出的Python路径是否为你安装six的版本。
  • 验证six模块可用性:用对应Python版本执行python -c "from six.moves import urllib; print('ok')",若报错说明six未正确安装到该环境,需重新执行pip install six(确保使用对应Python的pip,比如python3 -m pip install six)。
  • 强制CMake使用指定Python:执行CMake前,先设置环境变量指定Python路径,例:
    set PYTHON_EXECUTABLE=C:\Python39\python.exe
    CMAKE -G "Visual Studio 17" -A x64 ..
    

2. 修复download_from_google_storage.py的依赖导入

  • 打开该脚本,检查是否存在from six.moves import xxx的语句(脚本中实际用到的模块,比如urllib、configparser等),如果缺失,添加对应导入,而不只是import six。例如:
    from six.moves import urllib
    from six.moves import configparser
    

3. 手动下载clang-format跳过自动下载流程

  • 将报错中的gs://替换为https://storage.googleapis.com/,得到文件下载链接:https://storage.googleapis.com/chromium-clang-format/66882fadbf9e99cc00b8677d8c1e7e8b3cfdf4fe
  • 下载文件后,找到Java CEF构建目录下的third_party\clang-format文件夹,将下载的文件放入其中,并重命名为clang-format.exe(Windows平台)。
  • 重新执行CMake命令,此时会跳过下载步骤直接使用已放置的文件。

4. 配置PYTHONPATH环境变量

  • 执行pip show six查看six的安装路径,例如输出中的Location: C:\Python39\Lib\site-packages
  • 将该路径添加到系统或用户的PYTHONPATH环境变量中,确保Python能找到six模块。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 22:12:44