在使用pip安装xlrd之后,我仍然无法让它在我的脚本中工作。我不确定我是否遗漏了一些显而易见的东西-请帮忙!
目前,在命令行中输入pip list可以得到以下结果:pip (9.0.1)
setuptools (32.1.0)
wheel (0.29.0)
xlrd (1.0.0)
输入pip show xlrd将给出:Name: xlrd
Version: 1.0.0
Summary: Library for developers to extract data from Microsoft Excel (tm) spreadsheet files
Home-page: http://www.python-excel.org/
Author: John Machin
Author-email: sjmachin@lexicon.net
License: BSD
Location: /usr/local/lib/python2.7/site-packages
Requires:
然而,如果我进入python环境(通过在命令行上键入python)并尝试导入,那么我得到的是:Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xlrd
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named xlrd
以前有人遇到过这个问题吗?我还安装了python 3,并通过pip3下载了xlrd。然而import xlrd在两个版本(2或3)上都不起作用。