【问题标题】:Google protocol buffers not found when trying to freeze python app尝试冻结 python 应用程序时未找到 Google 协议缓冲区
【发布时间】:2012-12-01 12:04:34
【问题描述】:

当尝试使用 cx_freeze、bbfreeze、pyinstaller 或 py2exe 中的任何一个冻结 python (2.7) 应用程序时,被冻结的应用程序找不到 google.protobuf。

在冻结过程的日志中通常会出现“找不到 google”之类的内容。所以google包没有找到也没有打包,虽然它在python的site-packages中,非冻结版本也可以。

【问题讨论】:

    标签: python py2exe pyinstaller cx-freeze


    【解决方案1】:

    我在写这个问题时已经有了解决方案——我把它放在这里是因为其他人很可能会在这里很容易地找到它。

    解决方案:在 python 安装目录的Lib/site-packages/google 中创建空的__init__.py,并以某种方式编译它(例如交互式 python 会话中的import google)。 当包目录中有__init__.pyc时,冻结工具开始工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-16
      • 2011-10-18
      相关资源
      最近更新 更多