From 65677c16accc2df3044c6b7a032425bbedcb0090 Mon Sep 17 00:00:00 2001 From: "K.H.CHOI" Date: Wed, 27 Mar 2024 18:12:52 +0900 Subject: [PATCH] =?UTF-8?q?pyinstaller=EB=A5=BC=20=EC=9C=84=ED=95=9C=20set?= =?UTF-8?q?up.py=EC=88=98=EC=A0=95.=20=EA=B7=B8=EC=99=B8=20torch=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + edit/options.py | 7 +- main.spec | 25 +++---- modify_products.py | 4 +- setup.py | 177 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 196 insertions(+), 21 deletions(-) create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index 2d5802f..5900755 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ Lib/ +libs/ Scripts/ +build/ +dist/ +Include/ __pycache__/ *.log *.log.* diff --git a/edit/options.py b/edit/options.py index af8ee2a..6efe051 100644 --- a/edit/options.py +++ b/edit/options.py @@ -6,7 +6,7 @@ from selenium.webdriver.common.keys import Keys import time from edit.action_elements import click_element, return_element from ai.deepl import trans -from ai.compare import find_most_similar_image_by_one +# from ai.compare import find_most_similar_image_by_one import re import logging @@ -77,8 +77,9 @@ def modify_option_page(driver, original_img): option_images_urls.append(img_url) # 유사도 비교로 적합한 이미지를 가진 옵션번호 저장 - similarity = find_most_similar_image_by_one(original_img, img_url) - + # similarity = find_most_similar_image_by_one(original_img, img_url) + similarity = 0.7 + if similarity > 0.6: selected_option_indexes.append(i) logger.debug(f"옵션번호 {i}번이 이미지 유사도 {similarity}로 선택되었습니다.") diff --git a/main.spec b/main.spec index 1067762..aa60231 100644 --- a/main.spec +++ b/main.spec @@ -1,43 +1,36 @@ # -*- mode: python ; coding: utf-8 -*- - a = Analysis( ['main.py'], pathex=[], binaries=[], - datas=[], - hiddenimports=[], + datas=[('H:\\py\\per368\\Lib\\site-packages\\paddleocr', 'paddleocr')], + hiddenimports=['shapely'], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=False, ) -pyz = PYZ(a.pure) - +pyz = PYZ(a.pure, a.zipped_data) exe = EXE( pyz, a.scripts, + a.binaries, + a.datas, [], - exclude_binaries=True, name='main', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, - console=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + onefile=True, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, ) -coll = COLLECT( - exe, - a.binaries, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='main', -) diff --git a/modify_products.py b/modify_products.py index 445e63c..58c9c2d 100644 --- a/modify_products.py +++ b/modify_products.py @@ -269,12 +269,12 @@ def modify_products(driver, gemini, mongo_config, set_num_modify): click_element(driver, 'CSS_SELECTOR', '.ant-tabs-tab:nth-child(4)', wait_time=10, click_type='normal') logger.debug("키워드 수정작업 시작") - # edit_tag(driver, product_infos[i-1]) + edit_tag(driver, product_infos[i-1]) logger.debug("키워드 수정작업 완료") # 여기에 상품 수정 관련 코드 추가 logger.debug("옵션 수정작업 시작") - # modify_option_page(driver, product_infos[i-1]) + modify_option_page(driver, product_infos[i-1]) logger.debug("옵션 수정작업 완료") logger.debug("가격 수정작업 시작") diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a2c08e4 --- /dev/null +++ b/setup.py @@ -0,0 +1,177 @@ +import sys +from cx_Freeze import setup, Executable + +# 실행 파일에 대한 정보 +executables = [ + Executable('main.py', # 패키징할 메인 스크립트 파일 + base=None, # 실행 파일에 대한 기본 플랫폼. None으로 설정하여 기본값 사용 + # targetName='AutoPercenty.exe' + ), # 생성될 실행 파일의 이름 +] + +# 포함할 freeze 목록 +freeze_list = [ + 'altgraph', + 'annotated-types', + 'ansicon', + 'astor', + 'attrdict', + 'attrs', + 'Babel', + 'bce-python-sdk', + 'beautifulsoup4', + 'blessed', + 'blinker', + 'bs4', + 'cachetools', + 'certifi', + 'cffi', + 'chardet', + 'charset-normalizer', + 'click', + 'colorama', + 'contourpy', + 'cryptography', + 'cssselect', + 'cssutils', + 'cycler', + 'Cython', + 'decorator', + 'dnspython', + 'editor', + 'et-xmlfile', + 'fake-useragent', + 'filelock', + 'fire', + 'Flask', + 'flask-babel', + 'fonttools', + 'fsspec', + 'future', + 'google', + 'google-ai-generativelanguage', + 'google-api-core', + 'google-auth', + 'google-cloud', + 'google-generativeai', + 'googleapis-common-protos', + 'googletrans', + 'grpcio', + 'grpcio-status', + 'h11', + 'h2', + 'hpack', + 'hstspreload', + 'httpcore', + 'httpx', + 'hyperframe', + 'idna', + 'imageio', + 'imgaug', + 'importlib-metadata', + 'importlib-resources', + 'inquirer', + 'install', + 'itsdangerous', + 'Jinja2', + 'jinxed', + 'kiwisolver', + 'lazy_loader', + 'lmdb', + 'lxml', + 'MarkupSafe', + 'matplotlib', + 'mpmath', + 'networkx', + 'numpy', + 'opencv-contrib-python', + 'opencv-python', + 'opencv-python-headless', + 'openpyxl', + 'opt-einsum', + 'outcome', + 'packaging', + 'paddleocr', + 'paddlepaddle', + 'pandas', + 'pdf2docx', + 'pefile', + 'pillow', + 'premailer', + 'proto-plus', + 'protobuf', + 'psutil', + 'pyasn1', + 'pyasn1-modules', + 'pyclipper', + 'pycparser', + 'pycryptodome', + 'pydantic', + 'pydantic_core', + 'pyinstaller', + 'pyinstaller-hooks-contrib', + 'pymongo', + 'PyMuPDF', + 'pyparsing', + 'PyQt5', + 'PyQt5-Qt5', + 'PyQt5-sip', + 'PySocks', + 'python-dateutil', + 'python-docx', + 'pytz', + 'pywin32-ctypes', + 'PyYAML', + 'rapidfuzz', + 'rarfile', + 'readchar', + 'requests', + 'rfc3986', + 'rsa', + 'runs', + 'safeIO', + 'scikit-image', + 'scipy', + 'selenium', + 'selenium-stealth', + 'shapely', + 'six', + 'sniffio', + 'sortedcontainers', + 'soupsieve', + 'sympy', + 'termcolor', + 'tifffile', + 'torch', + 'torchvision', + 'tqdm', + 'translatepy', + 'trio', + 'trio-websocket', + 'typing_extensions', + 'tzdata', + 'urllib3', + 'visualdl', + 'wcwidth', + 'Werkzeug', + 'wsproto', + 'xmod', + 'zipp' +] + +# 패키지 정보 설정 +options = { + 'build_exe': { + 'includes': freeze_list, # 포함할 freeze 목록 + 'packages': ["annotated_types"] # 필요 시 여기에 추가 패키지를 포함 + } +} + +# 실행 파일 생성 +setup( + name='AutoPercenty', # 프로그램 이름 + version='1.0', # 버전 + description='퍼센티 자동화 프로그램', # 설명 + executables=executables, # 실행 파일 정보 + options=options # 패키지 정보 +)