問題:
cx_freezeで生成された.exeを別のマシンに配布できません。exeには.exeを生成したマシン上の絶対パスへの参照が含まれているようです。また"include_msvcr": True、ファイルをコピーしなかったため、vcruntime140.dllを直接含める必要がありました。
セットアップ
- 勝利10
- Python 3.7.2
- cx_freeze 6.0
- virtualenvはありません(重要ではないようですが、envvで試しました)
同様の質問
この質問は以前に同様の形式で尋ねられましたが、答えはありません:cx_Freezeはパスをコピーします
エラーログ
スクリプトを開始すると、次のエラーが表示されます(ウィンドウからコピー/貼り付けできないため、画像を共有します)。C:\Program Files (x86)\Python....他のマシンにはない絶対パスへの参照を見ることができます。
凍結スクリプト
from os.path import dirname
from cx_Freeze import setup, Executable
from config import settings
import os.path
import sys
import glob
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
DEPENDENCY_DIR = os.path.join(os.getcwd(), 'dependencies')
os.environ['TCL_LIBRARY'] = os.path.join(DEPENDENCY_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(DEPENDENCY_DIR, 'tcl', 'tk8.6')
packages = ["sepa", "datev", "atexit", "shiboken2", "PySide2"]
includes = []
excludes = ["Pyside2.Qt5WebEngineCore.dll"]
includefiles = ['qt', 'settings', 'config', os.path.join(DEPENDENCY_DIR, 'DLLs', 'tk86t.dll'),
             os.path.join(DEPENDENCY_DIR, 'DLLs', 'tcl86t.dll'), os.path.join(DEPENDENCY_DIR, 'DLLs', 'vcruntime140.dll')]
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": packages,
                     "excludes": excludes,
                     "includes": includes,
                     "include_files": includefiles,                     
                     "optimize": 2,
                     "include_msvcr": True}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"
setup(name="sepa_converter",
      version=settings.version,
      description="Programm zum Konvertiern von SEPA Dateien zum importieren in Buchhaltungsprogramme",
      options={"build_exe": build_exe_options},
      executables=[Executable("export_gui.py", base=base)])
#Debug DLLs von Pyside2 löschen
tmp = glob.glob("build/*/Pyside2/*d.dll")
for i in tmp:
    os.remove(i)
tmp = glob.glob("build/*/Pyside2/*/*/*d.dll")
for i in tmp:
    os.remove(i)
filelist = ['Qt5WebEngineCore.dll', 'icudt54.dll', 'opengl32sw.dll', 'Qt5Designer.dll', 'd3dcompiler_47.dll', 'Qt5Quick.dll']
for f in filelist:
    for i in glob.glob("build/*/Pyside2/%s" % f):
        os.remove(i)
                  関連する
                
                
                  
                    —
                    未解決の
                    
                  
                
              
                  私も同じ問題を抱えています。
                
                
                  
                    —
                    jonathan9879 
                    
                  
                
              