본문 바로가기

지식/Python7

Jupyter Notebook - 기본 디렉토리 변경 주피터 노트북은 웹 브라우저 기반의 오픈 소스 웹 애플리케이션으로, 파이썬을 비롯한 다양한 프로그래밍 언어로 코드를 작성하고 실행할 수 있는 개발 환경이다. 초보자부터 데이터 분석 전문가까지도 사용하는 매우 유용한 프로그램이다. 설치 후 실행하면 default directory가 C:\User\user로 되어있는데, 작성한 코드를 관리하기엔 불편한 경로이다. 그래서 디폴트 경로를 변경하는 방법을 알아보기로 했다. 1. jupyter_notebook_config.py 파일 수정 Anaconda Prompt를 실행한 다음, 열린 프롬프트 창에서 jupyter notebook --generate-config 를 입력하면 jupyter_notebook_config.py 파일 경로를 확인 가능하다. - 해당 경로.. 2023. 4. 10.
pytube 로 mp3/mp4 download pytube는 dependency가 없는 youtube 비디오를 다운로드할 수 있는 라이브러리다. pytube — pytube 12.1.0 documentation pytube — pytube 12.1.0 documentation © Copyright Revision 2e307d8d. pytube.io from tkinter import * from tkinter import messagebox from pytube import YouTube import glob import os.path import subprocess # set root = Tk() root.title("my converter") root.geometry("500x200") root.resizable(False, False) DOWN.. 2022. 5. 29.
Windows10 에 ffmpeg 설치하기 ffmpeg은 디지털 비디오와 오디오를 여러가지 형태로 저장하거나 변환하는 프로그램이다. NVIDIA와 AMD는 자사의 그래픽카드의 하드웨어 가속을 위해서 ffmpeg에 소스를 직접 주고 ffmpeg이 시키는대로 수정할 정도이니 관련 프로그램들 중에선 표준이라고 불릴만도 하다. GUI를 제공하진 않아서 윈도우에서도 명령어를 직접 넣어서 저장/변환이 가능하다. 1. 설치 아래 링크로 접속하면 윈도우에서 실행할 수 있는 exe 파일을 다운로드 받을 수 있다. https://ffmpeg.org/download.html#build-windows FFmpeg Converting video and audio has never been so easy. $ ffmpeg -i input.mp4 output.avi New.. 2022. 5. 29.
Python - 웹크롤링 1. 웹드라이버 사용 방법 element = driver.find_element_by_id("q") => 검색어를 입력하는 element를 지정 driver.find_element_by_id("q").click() => 현재 웹페이지에서 "q"라는 id를 찾아서 클릭해라 element.send_keys("날씨") => id가 "q"인 element에 "날씨"를 입력 element.send_keys("\n") => 엔터키를 입력 1.1. 웹페이지의 특정 element에 접근하는 방식들 - find_element_by_id('html_id') - find_element_by_name('html_name') - find_element_by_xpath('/html/body/some/xpath') - find_e.. 2021. 6. 28.
Python - Anaconda 설치 및 Notepad++로 실행하기 ■ Anaconda 설치 - Anaconda download 페이지로 이동 anaconda.com 에서 Product -> individual edition 을 클릭 -> python 3.x 버전용 anaconda 다운로드 - Anaconda 설치파일 실행 . all users 로 선택 . advanced options 는 모두 선택해야 아무 폴더에서나 python 실행 가능 ■ Notepadd++ 로 Python 실행하기 1. notepad++ 다운로드 - https://notepad-plus-plus.org/downloads 2. notepad++ 설치 3. NppExec 플러그인 설치 - 노트패드++에서 "플러그인->플러그인 관리" 에 들어가서 NppExe를 선택하고 설치 4. notepad++ 재.. 2020. 10. 5.
Python - exe 실행파일 만들기 1. PIP로 pyinstaller 설치하기 C:\Users\user> pip install pyinstaller 2. 작성한 코드를 파이썬(.py) 파일로 저장 3. 실행파일 만들기 (mytest.py) pyinstaller --onefile mytest.py 4. pyinstaller를 실행한 경로의 dist 라는 폴더에 mytest.exe 라는 실행파일이 생성 됨 5. 윈도우 탐색기에서 mytest.exe 를 더블클릭하면 실행이 됨 * 추가 만들어진 exe파일을 실행하면 검은색 커맨드창이 떴다가 사라지는데 옵션추가로 커맨드창이 뜨지 않게 할 수 있다. pyinstaller --onefile -noconsole mytest.py * 추가 2 실행시키면 "KeyError: 'streamingData' .. 2020. 10. 4.