본문 바로가기

728x90
반응형

# Python

(12)
[Numpy] Numpy, Pandas, Matplotlib 버전 문제 문제 발생 이전 포스트에 올렸던 것처럼 아래와 같은 경고가 나왔다. module 'numpy' has no attribute 'object', 'bool', 'typeDict'. 이전에는 야매(?)로 해결했는데 이번에는 근본적인 해결책을 찾은 것 같다. 문제 발생 원인은 numpy의 버전이 업데이트 되면서 변수명이 달라지게 되면서 다른 모듈에서 numpy의 이전 변수를 호출하여 위와같은 메시지가 발생한 것이다. 즉, numpy와 기타 모듈의 버전을 낮춰주면 되는 것이다. numpy 1.21.0 릴리즈 노트를 확인하면 해당 변경에 대한 메시지를 확인할 수 있다. 따라서 1.21.0의 이전버전을 사용하면 해당 에러는 발생하지 않을 것이다. numpy ..
[Numpy] module 'numpy' has no attribute 'object', 'bool', 'typeDict'. 에러 해결 텐서플로를 사용하기 위해서 tensorflow를 import하는 중 import tensorflow as tf 아래와 같은 오류가 나왔다. AttributeError: module 'numpy' has no attribute 'object'. `np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe. The aliases was originally deprecated in NumPy 1.20; for more details ..
[파이썬 시간 초과] try , except가 은근 시간을 잡아먹는다 copy. deepcopy()보다 슬라이싱이 훨씬 빨르다 pop을 많이하는 경우 list보다 deqeu가 더 빠르다
[Konlpy] 설치는 잘 따라 했는데 오류가 난다면! 자연어 처리를 위해서 konlpy를 설치했는데 아래와 같은 오류가 나왔다. 하.. 이 에러 외에도 다른 에러들도 차근차근 따라하면 해결할 수 있을 것이다. 1. 환경변수 설정 먼저 JAVA_HOME 환경 변수 설정을 해야 한다. JDK를 자신의 OS에 맞는 버전을 설치해준다. https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html 설치된 파일은 주로 C:\Program Files\Java\jdk* 에 위치한다. 내 PC -> [우클릭] -> [속성] -> [고급 시스템 설정] -> [고급] 탭 -> [환경 변수] [시스템 변수]에 [새로 만들기]를 눌러준다. 위 사진과 같이 변수 이름은 JAVA_HOME으로 변수 값은 자신의 ..
[보기쉬운 pyautogui] 4. 윈도우 - getWindowsWithTitle, getAll,Windows, getActiveWindow curWin = pyautogui.getActiveWindow() : 현재 활성화된 창 curWin.title : 창 이름 curWin.size : 창 크기 curWin.left, curWin.Right, curWin.top, curWin.bottom, pyautogui.getAllWindows() : 모든 창을 받아옴 for w in pyautogui.getAllWindows() : print(w.title) 모든 열린 창의 이름을 출력 pyautogui.getWindowsWithTitle('python') : 문자열이 들어간 이름을 가진 창을 받아옴 w = pyautogui.getWindowsWithTitle('python')[0] w.activate() 'python'이 들어간 첫번째 창을 활성화 ..
[보기쉬운 pyautogui] 2. 키보드 - write, press, hotkey, pyperclip 한글은 입력이 되지 않는다. 따라서 뒤에 나올 클립보드를 이용한다. pyautogui.write('hello') : hello를 입력 pyautogui.wirte(['wo', 'rld', 'enter'], interval=0.5) : 0.5초 간격으로 'wo', 'rld', 'enter'를 입력 pyautogui.KEYBOARD_KEYS : 단일 키 확인 가능(win, enter, esc 등) pyautogui.press('win') : 'win'버튼 눌렀다 뗌 pyautogui.keyDown('shift') : 'shift'버튼 누르고 있음 pyautogui.keyUp('shift') : 'shift'버튼 뗌 pyautogui.hotkey('alt', 'f4') : 단축키 한 번에 사용 가능 [순서 :..
[보기쉬운 pyautogui] 3. 이미지 - locateOnScreen, screenshot, pixel import pyautogui pyautogui.pixel(x, y) : (x, y)의 RGB값을 반환 pyautogui.pixelMatchesColor(x, y, (R, G, B)) : (x, y)의 RGB값이 (R, G, B) 숫자 값과 같은지 판단. RGB = pyautogui.pixel(x, y) pyautogui.pixelMatchesColor(x2, y2, RGB) pyautogui.pixelMatchesColor(x3, y3, (34, 167, 242)) pyautogui.screentshot( ) : 현재 화면을 스크린샷 img = pyautogui.screenshot() img.save('screenshot.png') 현재 화면을 스크린샷 찍고, 해당 파일을 'screenshot.png'..
[보기쉬운 pyautogui] 1. 마우스 제어 - click, move, moveTo, mouseInfo import pyautogui pyautogui.moveTo(x [가로], y [세로]) : (x, y) 위치로 이동 pyautogui.moveTo(x, y, duration = n) : n초동 안 이동 pyautogui.move(x, y) : 현재 위치에서 (x, y) 만큼 이동 pyautogui.move(x, y, duration = n) : n초 동안 현재 위치에서 (x, y)만큼 이동 pyautogui.click( ) : 클릭 pyautogui.click(x, y) : (x, y)를 클릭 pyautogui.click(click = 3) : 3번 클릭 pyautogui.rightClick( ) : 우클릭 pyautogui.middleClick( ) : 휠 버튼 클릭 pyautogui.mouseDow..

728x90
반응형