简体   繁体   English

无法使用 Anaconda 为 Python 安装 spacy

[英]Cannot install spacy for Python using Anaconda

I'm trying to install spacy for Python using Anaconda and I'm getting an odd error message:我正在尝试使用 Anaconda 为 Python 安装 spacy,但收到一条奇怪的错误消息:

python -m venv .env
source .env/bin/activate
conda install -c conda-forge spacy
python -m spacy download en_core_web_sm

Error Msg:错误消息:

  File "<ipython-input-13-1a465315722a>", line 2
    python -m venv .env
                 ^
SyntaxError: invalid syntax

I've tried several methods and none of them are working.我尝试了几种方法,但都没有奏效。

Any clue how to install this?任何线索如何安装这个?

Thanks!谢谢!

Instead of creating virtual environment like this.而不是像这样创建虚拟环境。 There is an option to create virtual environments in Anaconda with required Python version. 在 Anaconda 中可以选择使用所需的 Python 版本创建虚拟环境

conda create -n myenv python=3.8

To activate it:要激活它:

source activate myenv   # (in linux, you can use . as a shortcut for "source")
activate myenv          # (in windows - note that you should be in your c:\anaconda2 directory)

Try running these commands into the terminal instead of the Jupyter Notebook cells directly.尝试将这些命令直接运行到终端而不是 Jupyter Notebook 单元。 If you still want to do it that way, make it right by adding a !如果您仍然想这样做,请通过添加! in the beginning.在一开始的时候。

!python -m venv .env
!source .env/bin/activate
!conda install -c conda-forge spacy
!python -m spacy download en_core_web_sm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM