【发布时间】:2015-04-18 18:48:29
【问题描述】:
我在Windows 8.1 中使用Canopy package manager (Academic edition) 安装了xlrd 包。当我使用此代码时:
from xlrd import open_workbook
我有这个错误:
ImportError: cannot import name open_workbook
如果使用此代码:
from xlrd import * #There isn't any returned error for this specific line
并使用open_workbook() 作为函数,没有任何具有此名称的已定义函数。
有什么问题?
附言。
在 Ipyhton 中,import xlrd as xx 将使用单词(xx. 之后)。但是在编辑器中它不起作用。 from xlrd import * 将在 python 中工作(之后是 open_workbook())。
当我使用import xlrd as my_c 并在编辑器中运行它时,带有点符号的my_c. 在Iphyton 中有效,但在编辑器中无效!当我在编辑器中插入my_c 并按下标签时,我有my_c.xx。
【问题讨论】:
-
import xlrd 的输出是什么; xlrd.__file__ ?