问题
I am taking ML course in Coursera and I have installed GraphLab Create and ipython notebook.I am new to ML and python.
I get the following error,
import graphlab
sf = graphlab.SFrame('people-example.csv')
AttributeError Traceback (most recent call last) in ()
----> 1 sf = graphlab.SFrame('people-example.csv')
AttributeError: 'module' object has no attribute 'SFrame'
How do I fix this error?I have the people-example.csv in the correct path and no spelling mistake on SFrame Any help is greatly appreciated.Thank you.
回答1:
Make sure the library graphlab
is updated and works with your current python version. Changes on built-in libraries from python 2x to 3x are likely to cause issues like this one.
回答2:
In your iPython/Jupyter notebook follow these steps in this particular order.
- This will download and install dependencies.
graphlab.get_dependencies()
Restart Kernel :
Kernel > Restart
Now import graphlab:
import graphlab
sf = graphlab.SFrame('people-example.csv')
Hope this helps. Cheers!
回答3:
At first, you should run:
import graphlab
graphlab.product_key.set_product_key('your product key here')
where product_key
is a key you received to your email after registering on turi.com with your Coursera credentials.
After this operation everything's going to work fine.
回答4:
You need to restart the ipython kernel on your iPython/Jupyter notebook for graphlab to see the dependencies in the correct locations.
menu options:
Kernel > Restart
and try again. Worked for me.
回答5:
Change it to:
sf = graphlab.SFrame.read_csv('people-example.csv')
回答6:
ok i was having the same problem today and no one can help me ... but i finally found the solution of this problem .... first when you write the code make sure of some important thing 1- s an f in sframe must be capital 2- the most important when you writing people-example.csv write first 4 letters and hit ((tap)) it will continue the word . and here you are every thing is ok :)
来源:https://stackoverflow.com/questions/38938236/attributeerror-module-object-has-no-attribute-sframe