python接口测试,第三方包xlrd和xlutils,怎么安装

第1个:xlrd的下载地址:https://pypi.python.org/pypi/xlrd/0.9.2

安装过程:下载后解压文件夹,使用cd命令行进入该文件夹后,用命令:python setup.py install 之后再import发现安装好了

第2个:pip install xlutils 安装xlutils,就可以了

第3个:pip install jsonpath_rw,安装jsonpath_rw,就可以了

 

问题反馈:

报错:

File "/Volumes/MacHD/work/stock/main.py", line 20, in main
    xls= xlrd.open_workbook('Important_declaredate.xls',encoding_override='utf-8')
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/__init__.py", line 435, in open_workbook
    ragged_rows=ragged_rows,
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 91, in open_workbook_xls
    biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1258, in getbof
    bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1252, in bof_error
    raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found '\xd6\xb8\xb1\xea\\\xc8\xd5\xc6'

 解决方法:

查看一下对应的xls是否损坏,或者是否为xls文件,有可能只是后缀名为表格,内容实际上为json。我吧xls文件删除,重新建了一个xlsx文件,就好了。

posted @ 2018-04-27 14:31  qiao1234  阅读(632)  评论(0编辑  收藏  举报