Python错误:ImportError: cannot import name get_column_letter 解决办法
2018-06-05 09:07
627 查看
昨天刚遇到了因为python版本更新而遇到的错误,今天一大早又遇到了一次......
同样也是按照书《Python编程快速上手》P221页上的代码做练习,但是却遇到了如下的错误:import openpyxl from openpyxl.cell import get_column_letter,column_index_from_letter wb = openpyxl.load_workbook('example.xlsx') sheet = wb.get_sheet_by_name('Sheet1') get_column_letter(100)
D:\>python test.py Traceback (most recent call last): File "test.py", line 2, in <module> from openpyxl.cell import get_column_letter,column_index_from_letter ImportError: cannot import name 'get_column_letter'这个错误的意思就是导入 get_column_letter方法失败,于是Google了一下发现,get_column_letter方法已经在Openpyxl 的2.4版本中重写了,如今想要用此方法需要从openpyxl.utils中导入,而非从openpyxl.cell。因此正确的导入方式应该为:
from openpyxl.utils import get_column_letter阅读更多
相关文章推荐
- 网络爬虫在Python 3.5下出现“ cannot import name 'HTMLParseError'”错误解决办法
- 解决bs4在Python 3.5下出现“ImportError: cannot import name 'HTMLParseError'”错误
- 解决bs4在Python 3.6下出现“ImportError: cannot import name 'HTMLParseError'”错误
- python导入词云包失败:ImportError:cannot import name ‘WordCloud’的解决办法
- 'ImportError: cannot import name IncompleteRead' 错误解决
- python scrapy cannot import name xmlrpc_client的解决方案,解决办法
- 安装comtypes 0.6.2时ImportError: cannot import name DistutilsOptionError 解决办法
- python错误:ImportError: No module named setuptools解决办法
- python MySQLdb ImportError: cannot import name conversions 解决办法
- 【Scrapy】Scrapy在Python3下报错:“cannot import name '_win32stdio'”解决办法
- [解决办法]Python中使用json.loads解码字符串时出错:ValueError: Expecting property name: line 1 column 2 (char 1)
- [解决办法]Python中使用json.loads解码字符串时出错:ValueError: Expecting property name: line 1 column 2 (char 1)
- [解决办法]Python中使用json.loads解码字符串时出错:ValueError: Expecting property name: line 1 column 2 (char 1)
- ImportError: cannot import name 'ctc_ops'解决办法
- C++开发python扩展模块:ImportError: dynamic module does not define init function (initRabbit)解决办法
- python ImportError: No module named 的错误解决思路和方法
- python selectivesearch import Error:cannot import name 'selective_search'
- 运行JBoss 5.1.0 GA时出现Error installing to Instantiated:name=AttachmentStore state=Described错误的解决办法
- getDefinitionByName ReferenceError: Error #1065: 变量 未定义 解决办法
- python 错误: ImportError: cannot import name xxx