使用cx_Freeze构建exe时出现Tensorflow错误

时间:2017-07-23 12:22:18

标签: python tensorflow installation exe cx-freeze

我正在尝试使用cx_freeze构建程序的exe。我在setup.py文件中的include包中提到了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'

1 个答案:

答案 0 :(得分:0)

使用Python 3.5和Pyinstaller。这是我迄今为止唯一可以获得的解决方案。 CX_Freeze不是3.6中构建的有效解决方案(对于像tensor-flow,Scipy这样的软件包)

相关问题