ImportError when importing numpy under Spyder from within a Python 3.7 conda environment

你离开我真会死。 提交于 2021-01-27 23:19:29

问题


I have created a conda environment named python3 on my Ubuntu virtual machine using:

conda create -n python3 python=3.7

I have installed several packages under this environment, including numpy. When typing conda list, numpy shows up:

When running Python from the terminal, I can import numpy just fine, but this is no longer the case when working under the Spyder IDE: I get the following error:

ImportError: No module named numpy

Just for the record, I have reinstalled Spyder3 from my conda environment (sudo apt-get install spyder3) and I am launching Spyder from within this environment.

Any idea what I am doing wrong?


回答1:


The apt-get installation of Spyder does not know about your conda environment. You should use conda to install Spyder to the environment. Activate the environment, then launch Spyder.

conda install -n python3 spyder
conda activate python3
spyder


来源:https://stackoverflow.com/questions/57631847/importerror-when-importing-numpy-under-spyder-from-within-a-python-3-7-conda-env

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!