Python Code
>>> import matplotlib.pyplot as plt
Runtime Error
Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework.
Solution
- goto the folder: /Users/admin/.matplotlib
- create a file matplotlibrc with content:
backend: TkAgg
Python Code
>>> import urlparse
Import Error
No module named 'urlparse'
Solution
revise to
>> import urllib.parse
this is caused by the incompatibility that urlparse is for python2 and urllib.parse is for python3
Python Code
>>> def addlist(alist):
for i in alist:
yield i + 1
alist = [1, 2, 3, 4]
a = addlist(alist)
a.next()
Attribute Error
‘generator’ object has no attribute ‘next’
Solution
revise to
>>> def addlist(alist):
for i in alist:
yield i + 1
alist = [1, 2, 3, 4]
a = addlist(alist)
a.__next__()
this is caused by the incompatibility that next() is for python2 and __next__() is for python3