The problem is the use of different environments for your anaconda prompt and your instance of spyder, as mentioned by @Simon. This problem and the different available solutions are reviewed here: GitHub discussion
You can solve the problem as follows. Provided that you have the package spyder-kernels
already installed in your Anaconda prompt environment, run the following command in Anaconda prompt:
python -c "import sys; print(sys.executable)"
and copy the path returned to your console. Then, in Spyder go to Tools>Preferences>Python interpreter. Here you will see two options under Select the Python interpreter for all Spyder consoles. Check the second option and paste the path you copied from the Anaconda prompt. Close Spyder and open it again and now the import module
command should work.
By doing this, Spyder will basically use the Python interpreter from the environment in which you have installed the new modules.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…