मैं cx_Freeze का उपयोग करके .exe बनाने का प्रयास कर रहा हूँ। जब मैं इसे बनाने का प्रयास करता हूं, तो यह एक मान त्रुटि फेंकता है। मुझे ठीक से समझ नहीं आ रहा है कि इसका क्या मतलब है। क्या आपको लगता है कि cx_Freeze को फिर से स्थापित करने से समस्या का समाधान हो सकता है?

setup.py इस प्रकार है:

from cx_Freeze import setup, Executable
import os
import sys

base = None

if sys.platform == 'win32':
    base = 'Win32GUI'

exe = [Executable("main.py", base=base)]

os.environ['TCL_LIBRARY'] = r'C:\\Users\\dm\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\\Users\\dm\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tk8.6'

options = {
'build_exe': {
    'includes': ['scipy.io', 'scipy.spatial.ckdtree'],
    'include_files': [r'C:\\Users\\dm\\AppData\\Local\\Programs\\Python\\Python36\\DLLs\\tcl86t.dll', r'C:\\Users\\dm\\AppData\\Local\\Programs\\Python\\Python36\\DLLs\\tk86t.dll',
                      r'C:\\Users\\dm\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages\\pyqt5_tools\\platforms\\qwindows.dll'],
    'packages': ['pandas', 'numpy', 'scipy', 'pydub', 'librosa', 'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWidgets',
                 'python_speech_features'],
    }
}

setup(name="GUI", version="1.0", description='To be added',
  options=options, executables=exe)

इसे बनाते समय, मुझे निम्न त्रुटि मिल रही है।

running build
running build_exe
Traceback (most recent call last):
  File "setup.py", line 38, in <module>
options=options, executables=exe)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
distutils.core.setup(**attrs)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\dist.py", line 219, in run
freezer.Freeze()
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\freezer.py", line 616, in Freeze
self.finder = self._GetModuleFinder()
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\freezer.py", line 340, in _GetModuleFinder
finder.IncludeModule(name)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 651, in IncludeModule
namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 311, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 385, in _InternalImportModule
namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 417, in _LoadModule
namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 486, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 464, in _LoadModule
self._RunHook("load", module.name, module)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 537, in _RunHook
method(self, *args)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\hooks.py", line 567, in load_scipy
finder.IncludePackage("scipy.misc")
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 659, in IncludePackage
module = self._ImportModule(name, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 311, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 417, in _LoadModule
namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 486, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 475, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 565, in _ScanCode
module, relativeImportIndex)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 346, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 475, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 570, in _ScanCode
fromList, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 211, in _EnsureFromList
self._ImportModule(subModuleName, deferredImports, caller)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 311, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 475, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 589, in _ScanCode
topLevel = False)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 589, in _ScanCode
topLevel = False)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 570, in _ScanCode
fromList, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 211, in _EnsureFromList
self._ImportModule(subModuleName, deferredImports, caller)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 311, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 475, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 565, in _ScanCode
module, relativeImportIndex)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 311, in _ImportModule
deferredImports, namespace = namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 404, in _InternalImportModule
parentModule, namespace)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 464, in _LoadModule
self._RunHook("load", module.name, module)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\finder.py", line 537, in _RunHook
method(self, *args)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\hooks.py", line 526, in load_PyQt4_QtGui
name, QtCore = _qt_implementation(module)
  File "C:\Users\dm\AppData\Local\Programs\Python\Python36\lib\site-packages\cx_Freeze\hooks.py", line 437, in _qt_implementation
_qtcore = __import__(name, fromlist=['QtCore']).QtCore
ValueError: PyCapsule_GetPointer called with incorrect name

किसी भी मदद की सराहना की जाती है।

1
user8026974 11 फरवरी 2019, 12:42

1 उत्तर

सबसे बढ़िया उत्तर

आपकी सेटअप स्क्रिप्ट में tkinterऔर PyQt5 से संबंधित फ़ाइलें और पैकेज शामिल हैं, और आपके द्वारा पोस्ट किया गया स्टैक ट्रेस दिखाता है कि PyQt4 लोड करने के लिए हुक निष्पादित करते समय सेटअप स्क्रिप्ट विफल हो गई है, जो सुझाव देता है कि आपकी मुख्य स्क्रिप्ट कहीं PyQt4 आयात करती है। tkinter, PyQt4 और PyQt5 में से किसी एक GUI लाइब्रेरी को चुनें और अपनी मुख्य और सेटअप स्क्रिप्ट में केवल चुनी हुई लाइब्रेरी का उपयोग करें।

आप उन पुस्तकालयों को जोड़ सकते हैं जिनका आप उपयोग नहीं कर रहे हैं 'excludes' सूची आइटम में build_exe विकल्प शब्दकोश में cx_Freeze को शामिल न करने के लिए कहें।

0
jpeg 13 फरवरी 2019, 12:55