728x90
반응형
python spacy 설치 후 import까지는 문제가 없지만 모듈 사용시 오류가 발생했다.
conda install spacy
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\ProgramData\Anaconda3\envs\dev_python_37_env
added / updated specs:
- spacy
The following packages will be downloaded:
package | build
---------------------------|-----------------
catalogue-1.0.0 | py37_1 15 KB
cymem-2.0.3 | py37ha925a31_0 36 KB
cython-blis-0.4.1 | py37he774522_1 1.4 MB
importlib-metadata-1.7.0 | py37_0 52 KB
jsonschema-3.0.2 | py37_0 109 KB
murmurhash-1.0.2 | py37h33f27b4_0 26 KB
plac-0.9.6 | py37_1 41 KB
preshed-3.0.2 | py37h33f27b4_1 87 KB
pyrsistent-0.16.0 | py37he774522_0 95 KB
spacy-2.3.1 | py37h74a9793_0 3.9 MB
srsly-1.0.2 | py37ha925a31_0 180 KB
thinc-7.4.1 | py37h74a9793_0 999 KB
wasabi-0.6.0 | py_0 22 KB
------------------------------------------------------------
Total: 7.0 MB
The following NEW packages will be INSTALLED:
attrs pkgs/main/noarch::attrs-19.3.0-py_0
catalogue pkgs/main/win-64::catalogue-1.0.0-py37_1
cymem pkgs/main/win-64::cymem-2.0.3-py37ha925a31_0
cython-blis pkgs/main/win-64::cython-blis-0.4.1-py37he774522_1
importlib-metadata pkgs/main/win-64::importlib-metadata-1.7.0-py37_0
importlib_metadata pkgs/main/noarch::importlib_metadata-1.7.0-0
jsonschema pkgs/main/win-64::jsonschema-3.0.2-py37_0
murmurhash pkgs/main/win-64::murmurhash-1.0.2-py37h33f27b4_0
plac pkgs/main/win-64::plac-0.9.6-py37_1
preshed pkgs/main/win-64::preshed-3.0.2-py37h33f27b4_1
pyrsistent pkgs/main/win-64::pyrsistent-0.16.0-py37he774522_0
spacy pkgs/main/win-64::spacy-2.3.1-py37h74a9793_0
srsly pkgs/main/win-64::srsly-1.0.2-py37ha925a31_0
thinc pkgs/main/win-64::thinc-7.4.1-py37h74a9793_0
wasabi pkgs/main/noarch::wasabi-0.6.0-py_0
zipp pkgs/main/noarch::zipp-3.1.0-py_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
cymem-2.0.3 | 36 KB | ############################################################################################################################################################################################### | 100%
srsly-1.0.2 | 180 KB | ############################################################################################################################################################################################### | 100%
plac-0.9.6 | 41 KB | ############################################################################################################################################################################################### | 100%
wasabi-0.6.0 | 22 KB | ############################################################################################################################################################################################### | 100%
importlib-metadata-1 | 52 KB | ############################################################################################################################################################################################### | 100%
preshed-3.0.2 | 87 KB | ############################################################################################################################################################################################### | 100%
cython-blis-0.4.1 | 1.4 MB | ############################################################################################################################################################################################### | 100%
murmurhash-1.0.2 | 26 KB | ############################################################################################################################################################################################### | 100%
thinc-7.4.1 | 999 KB | ############################################################################################################################################################################################### | 100%
catalogue-1.0.0 | 15 KB | ############################################################################################################################################################################################### | 100%
jsonschema-3.0.2 | 109 KB | ############################################################################################################################################################################################### | 100%
pyrsistent-0.16.0 | 95 KB | ############################################################################################################################################################################################### | 100%
spacy-2.3.1 | 3.9 MB | ############################################################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: /
done
정상 설치 후 아래의 코드를 테스트 하는데 오류가 발생했다.
import spacy
nlp = spacy.load('en_core_web_sm')
doc = nlp('The fat cat sat on the mat')
for token in doc:
print(token.text, token.dep_, token.head.text)
아래와 같은 오류가 발생 ㅜ.ㅜ
Traceback (most recent call last):
File "D:/pythonProject/devTest/exec6_2.py", line 3, in <module>
nlp = spacy.load('en_core_web_sm')
File "C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\spacy\__init__.py", line 30, in load
return util.load_model(name, **overrides)
File "C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\spacy\util.py", line 175, in load_model
raise IOError(Errors.E050.format(name=name))
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
위의 오류 발생시 해결 방법이다.
python -m spacy download en
Collecting en_core_web_sm==2.3.1
Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz (12.0 MB)
|████████████████████████████████| 12.0 MB 6.8 MB/s
Requirement already satisfied: spacy<2.4.0,>=2.3.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from en_core_web_sm==2.3.1) (2.3.2)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.0.2)
Requirement already satisfied: srsly<1.1.0,>=1.0.2 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.0.2)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (2.0.3)
Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.0.0)
Requirement already satisfied: numpy>=1.15.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.19.1)
Requirement already satisfied: thinc==7.4.1 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (7.4.1)
Requirement already satisfied: blis<0.5.0,>=0.4.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (0.4.1)
Requirement already satisfied: plac<1.2.0,>=0.9.6 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (0.9.6)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (2.24.0)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (3.0.2)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (49.2.0.post20200714)
Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (0.6.0)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (4.47.0)
Requirement already satisfied: importlib-metadata>=0.20; python_version < "3.8" in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from catalogue<1.1.0,>=0.0.7->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.7.0)
Requirement already satisfied: idna<3,>=2.5 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (2.10)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (2020.6.20)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from requests<3.0.0,>=2.13.0->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1) (1.25.9)
Requirement already satisfied: zipp>=0.5 in c:\programdata\anaconda3\envs\dev_python_37_env\lib\site-packages (from importlib-metadata>=0.20; python_version < "3.8"->catalogue<1.1.0,>=0.0.7->spacy<2.4.0,>=2.3.0->en_core_web_sm==2.3.1)
(3.1.0)
Building wheels for collected packages: en-core-web-sm
Building wheel for en-core-web-sm (setup.py) ... done
Created wheel for en-core-web-sm: filename=en_core_web_sm-2.3.1-py3-none-any.whl size=12047114 sha256=9a02226f7969b5816985aa44353abc5e923be5237fa04eee500239ae78fbf657
Stored in directory: C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-ephem-wheel-cache-45crb4os\wheels\b7\0d\f0\7ecae8427c515065d75410989e15e5785dd3975fe06e795cd9
Successfully built en-core-web-sm
Installing collected packages: en-core-web-sm
Successfully installed en-core-web-sm-2.3.1
✔ Download and installation successful
You can now load the model via spacy.load('en_core_web_sm')
C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\spacy\data\en <<===>> C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\en_core_web_sm에 대한 기호화된 링크를 만들었습니다.
✔ Linking successful
C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\en_core_web_sm
-->
C:\ProgramData\Anaconda3\envs\dev_python_37_env\lib\site-packages\spacy\data\en
You can now load the model via spacy.load('en')
이렇게 설치 후 동작이 된다.
728x90
반응형
'Dev > Python' 카테고리의 다른 글
python-ERROR: Failed cleaning build dir for torch (0) | 2020.08.14 |
---|---|
python Lower & Upper (소문자& 대문자) (0) | 2020.08.11 |
TypeError: can only concatenate str (not "int") to str (0) | 2020.08.10 |
Anaconda3 설치 (0) | 2020.08.05 |
tensorflow 설치 오류 (0) | 2020.08.05 |