我试图按照this tutorial将自然语言处理包spaCy安装到python 3 anaconda环境中,Windows 8
我打开了控制台,cd-ed到我的site-packages文件夹,激活了环境,pip-ed for install,一切都很好,除了我不能在这里运行第二个命令
$ pip install spacy
$ python -m spacy.en.download
现在我可以成功加载包但是当我运行下面的第二行时,我收到以下错误
>>> from spacy.en import English #this works
>>> nlp = English() #this doesn't
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\garrett\Anaconda\envs\py3k\lib\site-packages\spacy\en\__init__.py", line 64, in __init__
get_lex_props=get_lex_props)
File "spacy/vocab.pyx", line 42, in spacy.vocab.Vocab.__init__ (spacy/vocab.cpp:2216)
OSError: Directory C:\Users\garrett\Anaconda\envs\py3k\lib\site-packages\spacy\en\data\vocab not found -- cannot load Vocab.
我认为这是因为我无法运行python -m spacy.en.download
有谁能让我知道python -m spacy.en.download
应该做什么?
是否有人可以提供有关如何在anaconda环境中安装spaCy的演练?
这是我在设置目录,激活python env,运行命令后得到的错误。我试过的前几次,我的spyder编辑器没反应,我杀了控制台,最近一次我收到了这个错误
$ cd C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages
$ C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages>activate py3k
$ [py3k] C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages>python -m spacy.en.download
Moving existing dir C:\Users\garrett\Anaconda\envs\py3k\Lib\site-packages\spacy\en\data to /tmp
Traceback (most recent call last):
File "C:\Users\garrett\Anaconda\envs\py3k\lib\runpy.py", line 160, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\garrett\Anaconda\envs\py3k\lib\runpy.py", line 73, in _run_code
exec(code, run_globals)
File ".\spacy\en\download.py", line 56, in <module>
plac.call(main)
File ".\plac_core.py", line 309, in call
cmd, result = parser_from(obj).consume(arglist)
File ".\plac_core.py", line 195, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File ".\spacy\en\download.py", line 51, in main
shutil.move(DEST_DIR, '/tmp')
File "C:\Users\garrett\Anaconda\envs\py3k\lib\shutil.py", line 521, in move
raise Error("Destination path '%s' already exists" % real_dst)
shutil.Error: Destination path '/tmp\data' already exists
感谢您提供的任何帮助或建议
答案 0 :(得分:1)
你已经点击了this bug,它应该已经在上一版本中得到修复。显然,spacy无法下载数据,因为目标已存在(可能来自之前中断的下载)。解决方法是删除var data
文件夹并重试下载。