无法在其他目录中导入pandas

时间:2016-03-12 13:13:29

标签: python pandas installation

我从这个link下载了大熊猫 然后我解压缩了site-packages中的pandas文件并运行python setup.py命令。

导入pandas在安装它的目录中正常工作

C:\Python27\ArcGIS10.3\Lib\site-packages\pandas-0.17.1>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>

一旦离开目录pandas-0.17.1,导入pandas就会产生以下结果:

C:\Python27\ArcGIS10.3\Lib\site-packages>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pandas
>>>

为什么会这样?

1 个答案:

答案 0 :(得分:1)

你应该像你一样在你的shell中添加PYTHONPATH。

设置PYTHONPATH =%PYTHONPATH%; C:\ Python27 \ ArcGIS10.3 \ Lib \ site-packages \ pandas-0.17.1