Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3 on Mac : ModuleNotFoundError: No module named 'mglearn'

I want to import a package called mglearn that I installed in Python 3.

But keep getting the following error;

ModuleNotFoundError: No module named 'mglearn'

I installed this package using the following command (I have multiple Python environments on the same MAC.)

$ python3.6 -m pip install --trusted-host pypi.python.org mglearn

I'm not sure if the following is the right way to confirm mglearn installed in Python3 but saw this;

$ python3 -c "help('modules')"|grep mglearn
_curses_panel       cmath               mglearn             stringprep

The PATH of my Mac is

PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/firstname.surname/.pyenv/versions/anaconda3-2.5.0/bin/:/Users/firstname.surname/.pyenv/shims:/Users/firstname.surname/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/Applications/Wireshark.app/Contents/MacOS

Can anyone tell me what I need to do to import mglearn?

like image 526
M. Thomas Avatar asked Feb 15 '26 01:02

M. Thomas


1 Answers

I tried pip install mglearn, after commenting out PATH for Python 2.7 in ~/.bash_profile so that PATH for Python 3.6 is only available. I could install mglearn and import mglearn. Maybe because I use Anaconda, pip command was necessary to install the package (This is just my guess.). Anyway, I could solve the problem.

like image 168
M. Thomas Avatar answered Feb 16 '26 14:02

M. Thomas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!