zoukankan      html  css  js  c++  java
  • [Python]xlrd.biffh.XLRDError: Excel xlsx file; not supported

    神奇~~帮几个同事安装配置python环境,突然跑着好好的一个脚本就跑不起来了。

    workbook = xlrd.open_workbook(bom_path)
      File "C:Python27libsite-packagesxlrd\__init__.py", line 170, in open_workbook
        raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
    xlrd.biffh.XLRDError: Excel xlsx file; not supported
    

    可我自己却好好的,想不通,最后通过pip list检查了一下自己安装的库版本,找到了不同的地方。

    我的电脑xlrd版本是1.2.0,给同事他们下载的是新的2.0.1,可能是是版本不兼容导致这个问题

    Installing collected packages: xlrd
    Successfully installed xlrd-2.0.1
    
    pip list
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Package                       Version
    ----------------------------- -------
    astroid                       1.6.6
    backports-abc                 0.5
    backports.functools-lru-cache 1.6.1
    click                         7.1.2
    configparser                  4.0.2
    enum34                        1.1.10
    et-xmlfile                    1.0.1
    futures                       3.3.0
    goto-statement                1.2
    isort                         4.3.21
    jdcal                         1.4.1
    lazy-object-proxy             1.5.0
    mccabe                        0.6.1
    numpy                         1.16.6
    openpyxl                      2.6.4
    pip                           20.1.1
    pylint                        1.9.5
    pyzmq                         19.0.1
    setuptools                    41.2.0
    singledispatch                3.4.0.3
    six                           1.15.0
    spark-parser                  1.8.9
    tornado                       5.1.1
    uncompyle                     2.0.0
    uncompyle6                    3.7.2
    uniout                        0.3.7
    wrapt                         1.12.1
    xdis                          5.0.1
    xlrd                          1.2.0
    xlwt                          1.3.0
    zmq                           0.0.0
    

    于是尝试了一下:卸载重新装旧版本,问题解决 : -):

    pip uninstall xlrd
    pip install xlrd==1.2.0
    
  • 相关阅读:
    Struts2快速后台验证 使用
    Python发送邮件
    【Python】【Flask】前端调用后端方法
    后台参数验证的几种方式
    使用 jQuery 进行前端验证
    postman接口测试——笔记
    安全测试
    jQuery 是javascript的一个库(常用插件、处理器)
    javascript 的 事件类型(事件)
    JavaScript的 基本数据类型---对象
  • 原文地址:https://www.cnblogs.com/xiaoqiangink/p/14144517.html
Copyright © 2011-2022 走看看