macos – ImportError: No module named sklearn (Python)

macos – ImportError: No module named sklearn (Python)

Make sure that pip and python are the same version.
For example if you run pip for python 2.7, it will install the package only in 2.7, and if your python command point to for example python 3.3 interpreter, it will not have that package

you dont have the package scikit-learn installed, try this if you are in a terminal linux :

sudo pip install scikit-learn

if you want to install the package within your code use

import os 
os.system(sudo pip install scikit-learn)

macos – ImportError: No module named sklearn (Python)

Try:

pip3 install scikit-learn

Leave a Reply

Your email address will not be published. Required fields are marked *