简体   繁体   中英

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

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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