Reputation: 2520
This is a commmon question, but nothing worked for me so far. I have seen this answer too Python 3 on Mac : ModuleNotFoundError: No module named 'mglearn'
!pip install mglearn
!pip install sklearn
!pip install -U scikit-learn
import mglearn
import sklearn
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-fe22f30497b9> in <module>
----> 1 import mglearn
2 import sklearn
ModuleNotFoundError: No module named 'mglearn'
I checked other questions but failed to solve it. I have macOS Catalina 10.15.7
Upvotes: 0
Views: 6015
Reputation: 1
After installing the jupyter notebook from anaconda or any of the distributions and there is still problems, install the jupyter notebook with pip , by running the command pip install jupyter on your cmd. Afterwards , launch the jupyter notebook from the cmd by just typing jupyter notebook . This version of jupyter notebook installed using pip work well with mglearn module rather than conda or anaconda distributions. Open any file and import your module , you are good to go.
Upvotes: 0
Reputation: 352
import sys
!{sys.executable} -m pip install mglearn
Try using this. This assures that you are using the pip version associated with the environment.
Upvotes: 3