Chromdriver를 사용하도록 설정하기 if getattr(sys, 'frozen', False) and hasattr(sys, "_MEIPASS"): driver_path = os.path.join(sys._MEIPASS, "chromedriver.exe") driver = webdriver.Chrome() # print('running in a Pyinstaller bundle') else: driver = webdriver.Chrome() # print('running in a normal Python process') pyinstaller로 실행파일 생성 pyinstaller -w -F "파이썬 소스코드 경로"
라이브러리 설치 # pip install opencv-python # pip install tensorflow-datasets==4.6.0 # 'cats_vs_dogs'는 tfds 버전 4.6.0 에서 실행됨 # tfds 최신 버전 에러 해결 # pip install tfds-nightly import cv2 import matplotlib.pyplot as plt import tensorflow_datasets as tfds import tensorflow as tf 오류 발생시 # URL 변경 오류 시 다시 세팅 setattr(tfds.image_classification.cats_vs_dogs, '_URL',"https://download.microsoft.com/download/3/E/1/3E1C..
진행 전 준비1. [Django] 초기 환경 세팅 ~ 서버 실행 에서 진행한 가상환경 활성화 (conda activate 가상환경명)환경 진입 (cd 작업 폴더 경로) 1. Setting 파일 수정*) 작업 환경에서 위 내용 실행 시 앱이름으로 생성된 폴더 있는지 확인*) myproject\settings.py의 INSTALLED_APPS에서 앱이름 추가2. myproject\urls.py 파일 수정from django.contrib import adminfrom django.urls import include, pathurlpatterns = [ path("myapp/", include("myapp.urls")), path("admin/", admin.site.urls),] 3. 생성한 앱 ..
Que) — python Beautifulsoup을 활용하여 웹크롤링 — style 속성 값을 가져오려고 한다. — style 속성 값을 딕셔너리로 변환한 후 key값이 ‘left’인 value 값을 추출 Final Code from bs4 import BeautifulSoup # 예시 HTML 코드 html = """ Hello World """ # HTML 파싱 soup = BeautifulSoup(html, 'html.parser') # style 속성값 가져오기 style = soup.find('div')['style'] # style 속성값을 딕셔너리 형태로 변환 keys = [] values = [] style_split = style.split("; ") print(style_split) f..
폴더명 추출 # 폴더명 추출 for item in os.listdir(file_path+App): sub_folder = os.path.join(file_path+App, item) # 폴더경로 + 폴더명 sub_folder2 = os.path.join(item) # 폴더명만 if os.path.isdir(sub_folder): # print("Application_version = " + sub_folder2) print("Application = " + sub_folder2) 파일 열기 # 파일 열기 with open(file_path+App+App_txt, "r", encoding="utf-8") as file: file_content = file.read() print("Application_ve..
주의사항 : 동일한 인터프리터 내에 pathlib 라이브러리가 있을 시 pyinstaller 실행 불가 가상 환경 생성 conda create -n 가상환경명 python==파이썬버전 가상 환경 활성화 conda activate 가상환경명 Pyinstaller 설치 pip install pyinstaller Pyinstaller를 활용한 exe 설치 파일 만들기 pyinstaller Z:\999_sjbang\운영\versionCheck.py