我的问题是我无法转换脚本,该脚本可以正常运行为.exe。 我正在使用自动Py执行。
我发现pyzbar不包含在受支持的程序包中。 仍然可以将我的脚本传输到可以正常运行的exe吗?
from pyzbar.pyzbar import decode
import cv2
import numpy as np
def barcodeReader(image, bgr):
gray_img = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
barcodes = decode(gray_img)
for decodedObject in barcodes:
points = decodedObject.polygon
pts = np.array(points, np.int32)
pts = pts.reshape((-1, 1, 2))
cv2.polylines(image, [pts], True, (0, 255, 0), 3)
for bc in barcodes:
cv2.putText(frame, bc.data.decode("utf-8") + " - " + bc.type, (30, 30), cv2.FONT_HERSHEY_SIMPLEX, 1,
bgr, 2)
return "Barcode: {} - Type: {}".format(bc.data.decode("utf-8"), bc.type)
bgr = (8, 70, 208)
cap = cv2.VideoCapture(0)
while (True):
ret, frame = cap.read()
barcode = barcodeReader(frame, bgr)
print(barcode)
cv2.imshow('Barcode reader', frame)
code = cv2.waitKey(100)
if code == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
Running auto-py-to-exe v2.6.5
Building in the current instances temporary directory at C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7
To get a new temporary directory, restart this application
Recursion Limit is set to 5000
Executing: pyinstaller -y --debug all "C:/Users/weber/Python/Barcode_lesen.py"
3635572 INFO: PyInstaller: 3.5
3635578 INFO: Python: 3.7.3
3635579 INFO: Platform: Windows-7-6.1.7601-SP1
3635602 INFO: wrote C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\Barcode_lesen.spec
3635637 INFO: UPX is not available.
3635706 INFO: Extending PYTHONPATH with paths
['C:\\Users\\weber\\Python',
'C:\\Users\\weber\\AppData\\Local\\Temp\\tmpv3ymb9i7']
3635708 INFO: checking Analysis
3635709 INFO: Building Analysis because Analysis-03.toc is non existent
3635710 INFO: Initializing module dependency graph...
3635821 INFO: Initializing module graph hooks...
3635854 INFO: Analyzing base_library.zip ...
3648725 INFO: running Analysis Analysis-03.toc
3648733 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\ProgramData\Anaconda3\python.exe
3649296 INFO: Caching module hooks...
3649338 INFO: Analyzing C:\Users\weber\Python\Barcode_lesen.py
3653669 INFO: Processing pre-find module path hook distutils
3658378 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
3660139 INFO: Processing pre-find module path hook site
3660142 INFO: site: retargeting to fake-dir 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
3670243 INFO: Loading module hooks...
3670243 INFO: Loading module hook "hook-cv2.py"...
3670246 INFO: Loading module hook "hook-distutils.py"...
3670250 INFO: Loading module hook "hook-encodings.py"...
3670510 INFO: Loading module hook "hook-importlib_metadata.py"...
3670515 INFO: Loading module hook "hook-lib2to3.py"...
3670531 INFO: Loading module hook "hook-numpy.core.py"...
3670545 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
3670559 INFO: Loading module hook "hook-numpy.py"...
3670560 INFO: Loading module hook "hook-pkg_resources.py"...
3671726 INFO: Processing pre-safe import module hook win32com
3672532 INFO: Loading module hook "hook-pycparser.py"...
3672533 INFO: Loading module hook "hook-pydoc.py"...
3672534 INFO: Loading module hook "hook-pytest.py"...
3674826 INFO: Loading module hook "hook-pythoncom.py"...
3676086 INFO: Loading module hook "hook-pywintypes.py"...
3677268 INFO: Loading module hook "hook-scipy.py"...
3677281 INFO: Loading module hook "hook-setuptools.py"...
3678821 INFO: Loading module hook "hook-sysconfig.py"...
3678823 INFO: Loading module hook "hook-win32com.py"...
3679975 INFO: Loading module hook "hook-xml.dom.domreg.py"...
3679977 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
3679978 INFO: Loading module hook "hook-xml.py"...
3680039 INFO: Looking for ctypes DLLs
3680147 INFO: Analyzing run-time hooks ...
3680154 INFO: Including run-time hook 'pyi_rth_pkgres.py'
3680161 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
3680166 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
3680191 INFO: Looking for dynamic libraries
3680523 WARNING: lib not found: impi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_intelmpi_ilp64.dll
3680652 WARNING: lib not found: impi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_intelmpi_lp64.dll
3680908 WARNING: lib not found: mpich2mpi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_mpich2_lp64.dll
3681271 WARNING: lib not found: pgf90.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_pgi_thread.dll
3681407 WARNING: lib not found: pgc14.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_pgi_thread.dll
3681523 WARNING: lib not found: pgf90rtl.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_pgi_thread.dll
3681654 WARNING: lib not found: msmpi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_msmpi_ilp64.dll
3681972 WARNING: lib not found: msmpi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_msmpi_lp64.dll
3682191 WARNING: lib not found: mpich2mpi.dll dependency of C:\ProgramData\Anaconda3\Library\bin\mkl_blacs_mpich2_ilp64.dll
3684767 INFO: Looking for eggs
3684767 INFO: Using Python library C:\ProgramData\Anaconda3\python37.dll
3684768 INFO: Found binding redirects:
[]
3685698 INFO: Warnings written to C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\build\Barcode_lesen\warn-Barcode_lesen.txt
3685922 INFO: Graph cross-reference written to C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\build\Barcode_lesen\xref-Barcode_lesen.html
3685996 INFO: checking PYZ
3685997 INFO: Building PYZ because PYZ-03.toc is non existent
3685997 INFO: Building PYZ (ZlibArchive) C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\build\Barcode_lesen\PYZ-03.pyz
3686001 INFO: Building PYZ (ZlibArchive) C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\build\Barcode_lesen\PYZ-03.pyz completed successfully.
3686019 INFO: checking PKG
3686020 INFO: Building PKG because PKG-03.toc is non existent
3686020 INFO: Building PKG (CArchive) PKG-03.pkg
3686067 INFO: Building PKG (CArchive) PKG-03.pkg completed successfully.
3686079 INFO: Bootloader C:\ProgramData\Anaconda3\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run_d.exe
3686079 INFO: checking EXE
3686079 INFO: Building EXE because EXE-03.toc is non existent
3686080 INFO: Building EXE from EXE-03.toc
3686085 INFO: Appending archive to EXE C:\Users\weber\AppData\Local\Temp\tmpv3ymb9i7\build\Barcode_lesen\Barcode_lesen.exe
3686370 INFO: Building EXE from EXE-03.toc completed successfully.
3686378 INFO: checking COLLECT
3686379 INFO: Building COLLECT because COLLECT-03.toc is non existent
3686381 INFO: Building COLLECT COLLECT-03.toc
3781922 INFO: Building COLLECT COLLECT-03.toc completed successfully.
Moving project to: C:\Users\weber\Desktop\auto-py-to-exe-master\auto-py-to-exe-master\output
Failed to move project, traceback follows:
Traceback (most recent call last):
File "C:\Users\weber\Desktop\auto-py-to-exe-master\auto-py-to-exe-master\auto_py_to_exe\__main__.py", line 284, in convert
move_project(dist_path, output_directory)
File "C:\Users\weber\Desktop\auto-py-to-exe-master\auto-py-to-exe-master\auto_py_to_exe\__main__.py", line 309, in move_project
shutil.move(os.path.join(src, file_or_folder), dst)
File "C:\ProgramData\Anaconda3\lib\shutil.py", line 561, in move
raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path 'C:\Users\weber\Desktop\auto-py-to-exe-master\auto-py-to-exe-master\output\Barcode_lesen' already exists
Complete.