xlrd在Mac的Jupyter笔记本上不起作用

时间:2019-07-10 13:58:06

标签: python excel python-3.x jupyter-notebook xlrd

我需要在Jupyter上读取一个Excel文件,因此当我打印时 data = pd.read_excel('data.xlsx')它显示:

 ImportError: Install xlrd >= 1.0.0 for Excel support

我同时使用pip install和conda install遵循xlrd安装过程,但是它始终显示相同的错误消息:

ImportError: Install xlrd >= 1.0.0 for Excel support

ModuleNotFoundError                       Traceback (most recent call last)
/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, filepath_or_buffer)
    390         try:
--> 391             import xlrd
    392         except ImportError:

ModuleNotFoundError: No module named 'xlrd'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-3-1d644c36f98f> in <module>
----> 1 df = pd.read_excel('../data/diseases.csv.gz')

/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
    186                 else:
    187                     kwargs[new_arg_name] = new_arg_value
--> 188             return func(*args, **kwargs)
    189         return wrapper
    190     return _deprecate_kwarg

/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs)
    186                 else:
    187                     kwargs[new_arg_name] = new_arg_value
--> 188             return func(*args, **kwargs)
    189         return wrapper
    190     return _deprecate_kwarg

/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/io/excel.py in read_excel(io, sheet_name, header, names, index_col, parse_cols, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, verbose, parse_dates, date_parser, thousands, comment, skip_footer, skipfooter, convert_float, mangle_dupe_cols, **kwds)
    348 
    349     if not isinstance(io, ExcelFile):
--> 350         io = ExcelFile(io, engine=engine)
    351 
    352     return io.parse(

/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, io, engine)
    651         self._io = _stringify_path(io)
    652 
--> 653         self._reader = self._engines[engine](self._io)
    654 
    655     def __fspath__(self):

/anaconda3/envs/holoviz-tutorial/lib/python3.7/site-packages/pandas/io/excel.py in __init__(self, filepath_or_buffer)
    391             import xlrd
    392         except ImportError:
--> 393             raise ImportError(err_msg)
    394         else:
    395             if xlrd.__VERSION__ < LooseVersion("1.0.0"):

 ImportError: Install xlrd >= 1.0.0 for Excel support

0 个答案:

没有答案