你可以在哪里找到spacy.py文件以重命名。

huangapple go评论119阅读模式
英文:

Where to find spacy.py file to rename

问题

我正在尝试安装spacy,尝试了多种方法,包括使用pipconda,以及直接从git安装。然而,我遇到了相同的错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[26], line 3
      1 import spacy
----> 3 nlp = spacy.load("en_core_web_sm")

AttributeError: module 'spacy' has no attribute 'load'

从阅读诸如这篇文章之类的各种在线文章中,我看到我的错误可能是由一个名为“spacy.py”的文件引起的阴影错误。然而,我找不到这个文件。我觉得这可能是一个容易找到的东西,但迄今为止还没有找到 你可以在哪里找到spacy.py文件以重命名。

在我的目录中使用which python显示:

/Users/my_name/anaconda3/bin/python

查看我的anaconda3/bin/python目录,我确实看到一个名为“spacy”的Unix可执行文件,但重命名它并没有解决我的错误。

英文:

I am attempting to install spacy and have tried a number of methods using pip, conda, and installing directing from git. However, I am running into the same error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[26], line 3
      1 import spacy
----> 3 nlp = spacy.load("en_core_web_sm")

AttributeError: module 'spacy' has no attribute 'load'

From reading various articles online like this one, I see that my error is likely due to a file called "spacy.py" that is causing a shadowing error. However, I can't find this file. I feel like this is likely an easy thing to find but have yet to find it 你可以在哪里找到spacy.py文件以重命名。

Using which python in my dir shows me:

/Users/my_name/anaconda3/bin/python

Looking into my anaconda3/bin/python dir, I do see a Unix Executable file named "spacy" but renaming it has not fixed my error.

答案1

得分: 1

确保您还安装了您喜欢的软件包:

对于pip:

python -m spacy download en_core_web_sm

此外,如果您在IDE中使用虚拟环境,您还应在安装spacy和您喜欢的软件包之前运行以下命令:

对于pip:

python -m venv .env
source .env/bin/activate

对于conda:

conda create -n venv
conda activate venv

您的环境之间也可能存在不匹配。如果您使用Anaconda,请尝试在Anaconda Powershell中安装spacy。否则,请尝试在IDE的终端中使用conda和/或pip安装spacy。

英文:

Make sure you're also installing your preferred package:

For pip:

python -m spacy download en_core_web_sm

Also, if you're using a virtual environment in your IDE, you should also run the following commands BEFORE installing spacy and your preferred package:

For pip:

python -m venv .env
source .env/bin/activate

For conda:

conda create -n venv
conda activate venv

There could also be a mismatch between your environments. If you're using Anaconda, try installing spacy in the Anaconda Powershell. Otherwise, try installing spacy using conda and/or pip in your IDE's terminal.

huangapple
  • 本文由 发表于 2023年8月11日 01:40:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76878134.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定