简体   繁体   中英

python showing import error while import openpyxl

while using python openpyxl , it is showing error , while openpyxl is updated .

[root@localhost callflowv2]# python
Python 2.7.5 (default, Nov 16 2020, 22:23:17)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl as op
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/openpyxl/__init__.py", line 6, in <module>
    from openpyxl.workbook import Workbook
  File "/usr/lib/python2.7/site-packages/openpyxl/workbook/__init__.py", line 4, in <module>
    from .workbook import Workbook
  File "/usr/lib/python2.7/site-packages/openpyxl/workbook/workbook.py", line 7, in <module>
    from openpyxl.worksheet.worksheet import Worksheet
  File "/usr/lib/python2.7/site-packages/openpyxl/worksheet/worksheet.py", line 396
    return f"{get_column_letter(min_col)}{min_row}:{get_column_letter(max_col)}{max_row}"

Actually latest version openpyxl not working well for load_workbook for python2.7 version . so just uninstall openpyxl by command --> pip uninstall openpyxl .

then reinstall openpyxl by giving providing version of same like for me

pip install openpyxl=2.5.3 works

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM