Я пытаюсь создать исполняемый файл из сценария Python с помощью cx_Freeze. Я нахожусь на Windows 10 в Anaconda3 virtualenv. Я использую: cx_Freeze
версию 6.2
; tensorflow
версия 1.15.0
. Ниже приведен файл setup.py
, который я использую для создания exe, вызывая python setup.py build
:
from cx_Freeze import setup, Executable
import os
import sys
import scipy
import skimage
import glob2
includeFiles = ["../../../../Anaconda3/Library/bin/mkl_intel_thread.dll", "../../../../Anaconda3/Library/bin/libiomp5md.dll", os.path.dirname(scipy.__file__), os.path.dirname(skimage.__file__), os.path.dirname(glob2.__file__)]
exe = Executable(script = "mainDefectDetection.py", base=None, targetName="Test.exe")
setup(name = "try", version = "0.1", description = "", options = {"build_exe": {"excludes": ["matplotlib.tests", "numpy.random._examples"], "include_files": includeFiles}}, executables = [exe])
Это отслеживание ошибки, которую я получил при выполнении файла exe:
Traceback (most recent call last):
File "C:\Users\me\Anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\me\Desktop\Tesi\TEST\prove\gui.py", line 32, in <lambda>
self.button2 = ttk.Button(self.labelFrame, text="", command= lambda: imageAnalysis(self.path, self.pathSlicing, self.pathCapture, self))
File "C:\Users\me\Desktop\Tesi\TEST\prove\mini3Defect.py", line 325, in imageAnalysis
image = pI.isk(captureImEven, "vgg", slicingIm.shape, pre.config)
File "C:\Users\me\Desktop\Tesi\TEST\prove\pieceIdentification.py", line 137, in isk
from keras_segmentation import predict
File "C:\Users\me\Anaconda3\lib\site-packages\keras_segmentation\predict.py", line 12, in <module>
from .train import find_latest_checkpoint
File "C:\Users\me\Anaconda3\lib\site-packages\keras_segmentation\train.py", line 6, in <module>
from keras.callbacks import Callback
File "C:\Users\me\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in <module>
from . import utils
File "C:\Users\me\Anaconda3\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
from . import conv_utils
File "C:\Users\me\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
from .. import backend as K
File "C:\Users\me\Anaconda3\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
from .load_backend import epsilon
File "C:\Users\me\Anaconda3\lib\site-packages\keras\backend\load_backend.py", line 89, in <module>
from .tensorflow_backend import *
File "C:\Users\me\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
File "C:\Users\me\Desktop\Tesi\TEST\prove\build\exe.win-amd64-3.7\tensorflow\__init__.py", line 99, in <module>
from tensorflow_core import *
File "C:\Users\me\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
ImportError: cannot import name 'pywrap_tensorflow' from 'tensorflow_core.python' (unknown location)
Как решить? Спасибо