问题
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