簡體   English   中英

cx_Freeze“沒有名為google的模塊”錯誤

[英]cx_Freeze “no module named google” Error

我在Python腳本中使用TensorFlow,我試圖凍結。 一切都很好,但當我嘗試運行它時,我收到此錯誤:

Traceback (most recent call last):
  File "C:\Users\mthun\AppData\Local\Programs\Python\Python35\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
    module.run()
  File "C:\Users\mthun\AppData\Local\Programs\Python\Python35\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
    exec(code, m.__dict__)
  File "app.py", line 2, in <module>
  File "D:\code\Github\codes-at-home\retrain.py", line 16, in <module>
    import tensorflow as tf
  File "C:\Users\mthun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\mthun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\mthun\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
    from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google'

我有另外兩個本地Python文件,我在主腳本中作為模塊導入。 他們都導入TensorFlow。 該應用程序在未凍結時完全正常。

這是我的setup.py

import sys
import os
from cx_Freeze import setup, Executable

PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
    "packages": ["os"],
    'include_files': [
        'MISTER-BRAINWASH.ico',
        os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
        os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll')
    ],
    "includes":['retrain','label_image','numpy.core._methods', 'numpy.lib.format']
}

# GUI applications require a different base on Windows (the default is for a console application).
base = None

executables = [
    Executable("app.py", base=base, icon='MISTER-BRAINWASH.ico'),
]

setup(
    name="Taxon",
    version="0.1",
    description="retrain inception with a GUI",
    options={"build_exe": build_exe_options},
    executables=executables
)

我看了, google確實在我的TensorFlow中包含在build目錄中。 我使用Python 3.5.2 64位和TensorFlow 1.5.0在Windows上運行

沒有名為'google'的模塊

要從谷歌導入谷歌或任何東西,谷歌目錄中必須有一個__init__.py文件。 在google目錄中創建該文件,您可以從中導入。 我有同樣的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM