I have already installed sklearn, but when I ran a python file that import sklearn, I get this:
Traceback (most recent call last):
File "first.py", line 3, in <module>
from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'
This is the result when I installed 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)
Firstly, make sure you update pip to latest version:
python -m pip install --upgrade pip
Then try:
pip install -U scikit-learn" on widnows terminal (cmd)
or try it with conda(if you have it on your pc)
conda install scikit-learn
also make sure you have installed numpy and scipy
pip install numpy
pip install scipy
If you use anaconda you can still use pip to install packages:
pip install -U scikit-learn scipy matplotlib
For Python 3.x use:
pip3 install -U scikit-learn scipy matplotlib
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.