简体   繁体   English

没有名为scipy,spacy,nltk的模块

[英]No module named scipy, spacy, nltk

(base) C:\\Users\\Kevin>pip install scipy Requirement already satisfied: scipy in c:\\programdata\\anaconda3\\lib\\site-packages (1.1.0) (基本)C:\\ Users \\ Kevin> pip install scipy已满足要求:c:\\ programdata \\ anaconda3 \\ lib \\ site-packages(1.1.0)中的scipy

etc 等等

Suddenly my jupyter notebook denies to import several packages. 突然,我的jupyter笔记本电脑拒绝导入多个软件包。 pandas and numpy work, but all the other packages do not (spacy, nltk, scipy, requests) pandas和numpy可以工作,但其他所有软件包都不工作(spacy,nltk,scipy,请求)

I tried reinstall packages, but it says I already have installed them. 我尝试重新安装软件包,但它说我已经安装了它们。

Why is this happening? 为什么会这样呢?

you can use which python to see what python you are using by default or !which python from a notebook cell to see what python jupyter is using. 您可以使用which python查看默认情况下使用的!which python ,或者从笔记本单元格中查看哪个python来查看使用的python jupyter。 To see where a package is installed you can use pip show package_name . 要查看软件包的安装位置,可以使用pip show package_name

You probably have installed the packages in another environment, or are starting jupyter from another environment, or the jupyter you are using is not the one installed in the base anaconda environment. 您可能已将软件包安装在另一个环境中,或者正在从另一个环境中启动jupyter,或者您正在使用的jupyter不是安装在基本anaconda环境中的软件包。

You can install a new environment with: 您可以使用以下方法安装新环境:

conda create -n my_env python=3 anaconda

Then you can activate the environment with conda activate my_env and then install packages in that environment with pip install ... and if you start jupyter from the active environment it will use that python. 然后,您可以使用conda activate my_env激活环境,然后使用pip install ...在该环境中安装软件包pip install ...如果从活动环境启动jupyter,它将使用该python。 With conda deactivate you go back to the base environment. conda deactivate您将返回base环境。

Check out https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html 查看https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Did you install Anaconda + Python ? 您安装了Anaconda + Python吗? Python doesn't come with package, maybe you're using Python path instead of Anaconda to run jupyter Python没有附带软件包,也许您使用的是Python路径而不是Anaconda来运行jupyter

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

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