Skip to content

Instantly share code, notes, and snippets.

@ychoi-kr
Created November 26, 2021 10:24
Show Gist options
  • Save ychoi-kr/a4a1bfab71548ea0810d271da63e6172 to your computer and use it in GitHub Desktop.
Save ychoi-kr/a4a1bfab71548ea0810d271da63e6172 to your computer and use it in GitHub Desktop.
KoNLPy 최신 버전 설치
import os
from urllib.parse import urlparse
import urllib.request
import zipfile
import tempfile
from subprocess import call
zip_url = 'https://github.com/konlpy/konlpy/archive/refs/heads/master.zip'
dirname = 'konlpy-master'
install_cmd = 'python setup.py install'
curr_dir = os.getcwd()
zipfilename = os.path.basename(urlparse(zip_url).path)
with tempfile.TemporaryDirectory() as tmpdirname:
downloadpath = tmpdirname + os.sep + zipfilename
print(f'Downloading {zip_url} to {downloadpath}...')
urllib.request.urlretrieve(zip_url, downloadpath)
print('Unzipping...')
with zipfile.ZipFile(downloadpath, 'r') as z:
for name in z.namelist():
print(name)
z.extract(name)
print('Installing...')
os.chdir(curr_dir + os.sep + dirname)
call(install_cmd)
@ychoi-kr
Copy link
Author

ychoi-kr commented Nov 26, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment