【问题标题】:Couldn’t link model to ‘en_core_web_md’ on a Windows 10无法在 Windows 10 上将模型链接到“en_core_web_md”
【发布时间】:2018-11-27 17:28:53
【问题描述】:

我尝试在 Windows 10 上使用 Rasa 尝试 a chatbot made by a friend of mine。开始安装后端 through their tutorial 我很惊讶在使用 python -m spacy link en_core_web_md en 后无法将模型链接到“en_core_web_md”。以下是完整的错误信息:

Error: Couldn't link model to 'en_core_web_md'
Creating a symlink in spacy/data failed. Make sure you have the required
permissions and try re-running the command as admin, or use a
virtualenv. You can still import the model as a module and call its
load() method, or create the symlink manually.

C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en_core_web_md


Creating a shortcut link for 'en' didn't work (maybe you don't have
admin permissions?), but you can still load the model via its full
package name: nlp = spacy.load('{name}')
Download successful but linking failed


(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>
(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>python -m spacy link en_core_web_md en

Error: Couldn't link model to 'en'
Creating a symlink in spacy/data failed. Make sure you have the required
permissions and try re-running the command as admin, or use a
virtualenv. You can still import the model as a module and call its
load() method, or create the symlink manually.

C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md
-->
C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\en

Traceback (most recent call last):
  File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
  File "C:\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\__main__.py", line 31, in <module>
plac.call(commands[command], sys.argv[1:])
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\cli\link.py", line 48, in link
symlink_to(link_path, model_path)
  File "C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\compat.py", line 87, in symlink_to
orig.symlink_to(dest)
  File "C:\Python36\lib\pathlib.py", line 1327, in symlink_to
self._accessor.symlink(target, self, target_is_directory)
  File "C:\Python36\lib\pathlib.py", line 393, in wrapped
return strfunc(str(pathobjA), str(pathobjB), *args)
OSError: symbolic link privilege not held

(cha_env36) C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation>sudo python -m spacy link en_core_web_md en
C:\Python36\python.exe: No module named spacy

这很奇怪,因为我能够在 Ubuntu 上这样做。 你有什么想法吗?

【问题讨论】:

标签: windows spacy rasa-nlu


【解决方案1】:

这是一个已知问题。实际上,您的错误消息正是给出了问题所在。该脚本无法为 en_core_web_md 创建符号链接(快捷方式)。执行以下操作以解决问题

  • 转到您的目录:C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\

  • 创建到目的地的快捷方式:C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md

  • 将其命名为en


如果您想知道如何创建快捷方式,以下屏幕截图可能会有所帮助

转到文件夹C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\spacy\data\并右键单击并创建快捷方式

提供目标目录:在你的情况下它是 C:\Users\antoi\Documents\Programming\Nathalie\Chatbot_RASA_room_reservation\cha_env36\lib\site-packages\en_core_web_md 然后点击下一步

您必须将快捷方式命名为en。然后点击完成

【讨论】:

    【解决方案2】:

    按照您提供的日志。 可能是权限问题。

    尝试以管理员权限打开 CMD,然后再次运行 spacy link 命令。

    【讨论】:

      【解决方案3】:

      我所做的是以管理员身份打开 bash,然后运行命令:

      python -m spacy link en_core_web_md en
      

      如果您使用的是 virtualenv,请确保先激活上述 virtualenv。

      【讨论】:

        【解决方案4】:

        您也可以在 cmd 中使用mklink 命令在所需文件夹中创建符号链接。

        MKLINK [[/D] | [/H] | [/J]] Link Target
        
                /D      Creates a directory symbolic link.  Default is a file
                        symbolic link.
                /H      Creates a hard link instead of a symbolic link.
                /J      Creates a Directory Junction.
                Link    Specifies the new symbolic link name.
                Target  Specifies the path (relative or absolute) that the new link
                        refers to.
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2018-05-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-11-10
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多