항상 konlpy를 설치할 때면 오류가 난다..... 오늘은 새로 만난 오류이다.. 띠요옹... 먼저, Anaconda에서 가상 환경을 생성하였고 생성한 가상 환경에 konlpy 설치 시도를 하였다.

(gensim_packs) C:\Users\LG>pip install konlpy

그리고 발생한 오류. 해시값이 일치하지 않는다고....

Collecting konlpy
  Downloading konlpy-0.5.2-py2.py3-none-any.whl (19.4 MB)
     |████████████████████████████████| 19.4 MB 819 kB/s eta 0:00:01
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    konlpy from https://files.pythonhosted.org/packages/85/0e/f385566fec837c0b83f216b2da65db9997b35dd675e107752005b7d392b1/konlpy-0.5.2-py2.py3-none-any.whl#sha256=65ab33ad28fb072306e44128ff3f23b5771d97d6501fa995511834ba8dd2bd40:
        Expected sha256 65ab33ad28fb072306e44128ff3f23b5771d97d6501fa995511834ba8dd2bd40
             Got        47430be567ed6661ac89c05c43f6d4a6ad61b9f6cead197ba92e083af906dd83

해결법은 jpype1를 먼저 설치해주는 것이다. (설치 결과 생략)

(gensim_packs) C:\Users\LG>conda install -c conda-forge jpype1
Collecting package metadata (current_repodata.json): done
Solving environment: done

다시 konlpy를 설치해준다.

(gensim_packs) C:\Users\LG>pip install konlpy
Collecting konlpy
  Downloading konlpy-0.5.2-py2.py3-none-any.whl (19.4 MB)
     |████████████████████████████████| 19.4 MB 327 kB/s
Collecting tweepy>=3.7.0
  Downloading tweepy-3.8.0-py2.py3-none-any.whl (28 kB)
Collecting beautifulsoup4==4.6.0
  Downloading beautifulsoup4-4.6.0-py3-none-any.whl (86 kB)
     |████████████████████████████████| 86 kB 578 kB/s
Collecting colorama
  Downloading colorama-0.4.3-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: JPype1>=0.7.0 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from konlpy) (0.7.5)
Requirement already satisfied: numpy>=1.6 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from konlpy) (1.18.5)
Collecting lxml>=4.1.0
  Downloading lxml-4.5.1-cp37-cp37m-win_amd64.whl (3.5 MB)
     |████████████████████████████████| 3.5 MB 386 kB/s
Requirement already satisfied: PySocks>=1.5.7 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from tweepy>=3.7.0->konlpy) (1.7.1)
Requirement already satisfied: requests>=2.11.1 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from tweepy>=3.7.0->konlpy) (2.24.0)
Collecting requests-oauthlib>=0.7.0
  Downloading requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Requirement already satisfied: six>=1.10.0 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from tweepy>=3.7.0->konlpy) (1.15.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from requests>=2.11.1->tweepy>=3.7.0->konlpy) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from requests>=2.11.1->tweepy>=3.7.0->konlpy) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from requests>=2.11.1->tweepy>=3.7.0->konlpy) (1.25.9)
Requirement already satisfied: idna<3,>=2.5 in c:\users\lg\anaconda3\envs\gensim_packs\lib\site-packages (from requests>=2.11.1->tweepy>=3.7.0->konlpy) (2.10)
Collecting oauthlib>=3.0.0
  Downloading oauthlib-3.1.0-py2.py3-none-any.whl (147 kB)
     |████████████████████████████████| 147 kB 409 kB/s
Installing collected packages: oauthlib, requests-oauthlib, tweepy, beautifulsoup4, colorama, lxml, konlpy
Successfully installed beautifulsoup4-4.6.0 colorama-0.4.3 konlpy-0.5.2 lxml-4.5.1 oauthlib-3.1.0 requests-oauthlib-1.3.0 tweepy-3.8.0

 

마지막으로 잘 설치가 되었는지 확인하기!

(gensim_packs) C:\Users\LG>python
Python 3.7.7 (default, May  6 2020, 11:45:54) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from konlpy.tag import Kkma
>>> from konlpy.utils import pprint
>>> kkma = Kkma()
>>> pprint(kkma.sentences(u'네, 안녕하세요. 반갑습니다.'))
['네, 안녕하세요.', '반갑습니다.']

'Python > 기본' 카테고리의 다른 글

[ERROR] Microsoft Visual C++ 14.0 is required.  (0) 2020.05.30

pip install scrapy를 하다가 마주친 빨간줄과 오류들.... 이 문제의 해결 방법을 간단히 정리하고자 한다.

문제

* error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/ *

 Building wheel for Twisted (setup.py) ... error
(중략)
    copying src\twisted\words\xish\xpathparser.g -> build\lib.win32-3.8\twisted\words\xish
    running build_ext
    building 'twisted.test.raiser' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\hyunk\scrapy-projects\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\hyunk\\AppData\\Local\\Temp\\pip-install-3j2599mv\\Twisted\\setup.py'"'"'; __file__='"'"'C:\\Users\\hyunk\\AppData\\Local\\Temp\\pip-install-3j2599mv\\Twisted\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\hyunk\AppData\Local\Temp\pip-record-pcewmclu\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\hyunk\scrapy-projects\include\site\python3.8\Twisted' Check the logs for full command output.

해결 방법

windows 10 64bit을 사용하고 있으므로 이에 맞는 Microsoft Visual C++ 14.0 환경을 구성해준다.

  1. https://visualstudio.microsoft.com/ko/vs/older-downloads/
  2. '재배포 가능 패키지 및 빌드 도구' 탭 클릭
  3. Microsoft Build Tools 2015 업데이트 3 '다운로드' 클릭
  4. 다운받은 인스톨러 설치

결과

설치 완료 후 다시 pip install scrapy을 해보면 패키지 설치가 성공됨을 알 수 있다.

Building wheels for collected packages: Twisted
  Building wheel for Twisted (setup.py) ... done
  Created wheel for Twisted: filename=Twisted-20.3.0-cp38-cp38-win32.whl size=3086623 sha256=708af701f60f0f36604fa89f9dd136ba5b35ac861e86f05edea3af6e44fe905c
  Stored in directory: c:\users\hyunk\appdata\local\pip\cache\wheels\f2\36\1b\99fe6d339e1559e421556c69ad7bc8c869145e86a756c403f4
Successfully built Twisted
Installing collected packages: cssselect, parsel, PyDispatcher, Twisted, pyOpenSSL, scrapy
Successfully installed PyDispatcher-2.0.5 Twisted-20.3.0 cssselect-1.1.0 parsel-1.6.0 pyOpenSSL-19.1.0 scrapy-2.1.0`

아래는 파이썬을 통해 scrapy 패키지를 불러온 결과이다.

(scrapy-projects) C:\Users\hyunk>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scrapy
>>> print('import 성공!')
import 성공!
>>>

'Python > 기본' 카테고리의 다른 글

Konlpy 설치 오류 해결법  (0) 2020.07.06

+ Recent posts