module not found on ipython notebook

前端 未结 2 1424
醉酒成梦
醉酒成梦 2021-02-13 02:58

I have an ipython notebook which starts with

import sklearn

When I run it, I get :

ImportError: No module named sklearn
         


        
2条回答
  •  无人共我
    2021-02-13 03:24

    I was able to fix this error on Ubuntu by adding a cell to the top of the notebook appending the module directory to the path:

    import sys
    sys.path.append('/usr/lib/python2.7/dist-packages')
    

    The path to add can be found when running pip install , (such as numpy) and it tells you where each package is installed or already exists.

提交回复
热议问题