# 如果没有安装 pandas,请反注释下面一行。
# !pip install pandas
%matplotlib inline
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet.gluon import data as gdata, loss as gloss, nn
import numpy as np
import pandas as pd
直接在jupyter运行上述代码,会提示以下错误:
无法import gluonbook
解决办法:
1.在文件夹gluon_tutorials_zh-1.0中有gluonbook文件
2.代码中增加
import sys
sys.path.append('..')
# 如果没有安装 pandas,请反注释下面一行。
# !pip install pandas
%matplotlib inline
import sys
sys.path.append('..')
import gluonbook as gb
from mxnet import autograd, gluon, init, nd
from mxnet.gluon import data as gdata, loss as gloss, nn
import numpy as np
import pandas as pd
参考:
1.https://discuss.gluon.ai/search?q=%E5%AE%89%E8%A3%85gluonbook