我有一個任務來讀取Python中的excel數據。我已經安裝了Python 2.7。我嘗試在Windows中使用以下命令安裝xlrd0.8.0。Python的xlrd導入問題2.7
C:\Python27\xlrd-0.8.0>python setup.py build
running build
running build_py
creating build
creating build\lib
creating build\lib\xlrd
copying xlrd\biffh.py -> build\lib\xlrd
....
C:\Python27\xlrd-0.8.0>python setup.py install
running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
running install_egg_info
Writing C:\Python27\Lib\site-packages\xlrd-0.8.0-py2.7.egg-info
安裝時沒有收到任何錯誤消息。我也看到在/ lib文件夾站點包xlrd-0.8.0文件夾...
但是,當我嘗試導入它,Python是不能識別它...
>>> import xlrd
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import xlrd
ImportError: No module named xlrd
燦你建議如何找到問題?
是你正在做使用相同的Python作爲命令行'進口xlrd'空閒的版本? –
我試圖打開另一個IDLE會話,看起來像它的工作。另一個IDLE有Python 2.7.2.5,而有問題的是2.7.5 ... – user2607677
打開一個交互式python shell。 'import sys; print sys.path'這是什麼回報?它會告訴你它正在檢查一個模塊的所有路徑。確認你的lib在這些路徑之一中。 – gregb212