Created
November 26, 2021 10:24
-
-
Save ychoi-kr/a4a1bfab71548ea0810d271da63e6172 to your computer and use it in GitHub Desktop.
KoNLPy 최신 버전 설치
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
설명: https://www.facebook.com/groups/pythonkorea/permalink/4579871662095959/