環境
Python 3.6.5 |Anaconda, Inc.
spacy=2.0.11
問題
Spacyの英語のモデルを使いたかった
conda install spacy
python -m spacy download en
しかし
/path_to_anaconda/bin/python: No module named spacy.__main__; 'spacy' is a package and cannot be directly executed
なんとspacyはパッケージだから直接実行できないと。
解決方法
condaを諦めてpipでインストールする。
pip install spacy
環境はAnacondaベースのためpip使って大丈夫だろうかと思いましたが、最早やむなし。動くことが大事。
condaとpip:混ぜるな危険
やったこと
1. condaでインストールしたSpacyとさよなら
conda uninstall spacy
2. pipでSpacyを入れるために入れたり消したり
distributed 1.21.8 requires msgpack, which is not installed.
pip install msgpack
Cannot uninstall 'preshed'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
conda uninstall preshed
Cannot uninstall 'murmurhash'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
conda uninstall murmurhash
3. pipでSpacyをインストール
pip install spacy
python -m spacy download en
python
>>> import spacy
>>> spacy.load('en')
<spacy.lang.en.English object at 0x7f9609368eb8>