首页 > 解决方案 > 无法在 Spyder IDE 中安装模块

问题描述

我有以下问题。我正在使用 Spyder IDE(但没有 Anaconda)。我要安装statsmodels.api. 查看我的步骤(我在 IPython 控制台中编写它们):

1)

import statsmodels.api as sm

Traceback (most recent call last):

  File "<ipython-input-1-085740203b77>", line 1, in <module>
    import statsmodels.api as sm

ModuleNotFoundError: No module named 'statsmodels'
pip install statsmodels
Note: you may need to restart the kernel to use updated packages.
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

ctrl然后我使用+ . 3)重新启动内核

IPython 7.22.0 -- An enhanced Interactive Python.

Restarting kernel... 

但是知道,当我再次尝试步骤 1) 时,我看不到任何进展。换句话说,模块没有安装。

4)

import statsmodels.api as sm
Traceback (most recent call last):

  File "<ipython-input-2-085740203b77>", line 1, in <module>
    import statsmodels.api as sm

ModuleNotFoundError: No module named 'statsmodels'

请问哪里有问题?

标签: pythonspyder

解决方案


在 IPython 控制台中使用!pip而不是。pip


推荐阅读