kma
kma

Reputation: 27

Cannot use import modules in jupyter notebook

I'm having trouble importing modules into Jupyter notebook. The sys.path is wrong and I don't know how to repair it.

From Jupyter sys.executableruns:

'/usr/----/opt/python/bin/python2.7'

From the command line it runs:

'/Users/----/miniconda2/bin/python'

so when I try running import MySQLdb, I get the following error:

---------------------------------------------------------------------------
ImportError                               
Traceback (most recent call last)
<ipython-input-10-dd22983d5391> in <module>()
----> 1 import MySQLdb

ImportError: No module named MySQLdb

However, within my command line my import module works fine. How do i remedy this? Thanks

Upvotes: 0

Views: 636

Answers (1)

Arduino_Sentinel
Arduino_Sentinel

Reputation: 819

install the module sudo pip install mysql-pythonelse,

You should try conda install ipykernel --name Python, python -m ipykernel install. Then it wil fix the notebook it will be seeing your Python kernel. Then create a new >Python notebook

Upvotes: 0

Related Questions