我已经安装了sklearn,但是当我运行一个导入sklearn的python文件时,我得到了这个:
Traceback (most recent call last):
File "first.py", line 3, in <module>
from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'
这是我安装sklearn时的结果:
Requirement already satisfied: scikit-learn in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (0.24.0)
Requirement already satisfied: numpy>=1.13.3 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.19.4)
Requirement already satisfied: scipy>=0.19.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.5.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (2.1.0)
Requirement already satisfied: joblib>=0.11 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn) (1.0.0)
3条答案
按热度按时间1bqhqjot1#
如果你使用anaconda,你仍然可以使用pip来安装软件包:
对于Python 3.x,请用途:
oxosxuxt2#
首先,请确保您更新pip到最新版本:
然后尝试:
或者用康达试试(如果你的PC上有的话)
还要确保你已经安装了numpy和scipy
gk7wooem3#
“sklearn”已更改为“scikit-learn”,并且“sklearn”不再有效。
因此在终端中:
更多信息在他们的网站:
https://scikit-learn.org
https://scikit-learn.org/stable/install.html