【问题标题】:Tensorflow error when building exe using cx_Freeze使用 cx_Freeze 构建 exe 时出现 TensorFlow 错误
【发布时间】:2017-08-30 22:58:51
【问题描述】:

我正在尝试使用 cx_freeze 构建程序的 exe。我在 setup.py 文件的包含包中提到了 tensorflow,但是当我构建它时,它显示了后面提到的错误。我在 Windows 10 上使用 python 3.6。

我已尝试卸载并重新安装 tensorflow,但仍然出现同样的错误

每当我运行 python setup.py build 时都会出错

这是我得到的以下错误

非常感谢

hdf5 is not supported on this machine (please install/reinstall h5py for optimal experience)
curses is not supported on this machine (please install/reinstall curses for an optimal experience)
Scipy not supported!
running build
running build_exe
Traceback (most recent call last):
  File "setup.py", line 31, in <module>
    executables = [cx_Freeze.Executable("Final.py",base=base)]
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
    self.run_command(cmd_name)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\dist.py", line 219, in run
    freezer.Freeze()
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\freezer.py", line 621, in Freeze
    self.finder = self._GetModuleFinder()
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\freezer.py", line 340, in _GetModuleFinder
    finder.IncludePackage(name)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 655, in IncludePackage
    self._ImportAllSubModules(module, deferredImports)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 287, in _ImportAllSubModules
    recursive)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 287, in _ImportAllSubModules
    recursive)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 287, in _ImportAllSubModules
    recursive)
  File "C:\Users\Jayesh Gupta\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 282, in _ImportAllSubModules
    raise ImportError("No module named %r" % subModuleName)
ImportError: No module named 'tensorflow.contrib.ios_examples.benchmark.benchmark.xcodeproj'

【问题讨论】:

  • 您好,欢迎来到 Stackoverflow!我建议您通过welcome tour 了解您的出行方式(并获得您的第一个徽章;))。另外,为了提高获得有用答案的机会,请查看how to ask 以及如何创建Complete, Minimal, and Verifiable examples。请显示给您问题的代码
  • 你能在这里显示你的 setup.py 脚本吗?

标签: python tensorflow installation exe cx-freeze


【解决方案1】:

使用 Python 3.5 和 Pyinstaller。这是迄今为止我能得到的唯一解决方案。 CX_Freeze 不是 3.6 中构建的有效解决方案(对于某些包,如 tensor-flow、Scipy)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-04
    • 2016-04-28
    • 1970-01-01
    • 2018-02-04
    相关资源
    最近更新 更多