ImportError:没有名为pandas的模块

时间:2017-04-07 03:40:00

标签: django pandas amazon-web-services django-rest-framework

我正在尝试将我的应用部署到Amazon Web Service EBS中,当我打开它时,它会一直提示我这个错误。

 ImportError at /safeplace/location/
 No module named pandas
 Request Method:    GET
 Request URL:   http://usafe2.epnjkefarc.us-west-
 2.elasticbeanstalk.com/safeplace/location/?lat=-37.877010&lng=145.044267
 Django Version:    1.10.6
 Exception Type:    ImportError
 Exception Value:   
 No module named pandas
 Exception Location:    /opt/python/current/app/api/views.py in <module>, 
 line 15
 Python Executable: /opt/python/run/venv/bin/python
 Python Version:    2.7.12
 Python Path:   
 ['/opt/python/run/venv/lib64/python2.7/site-packages',
 '/opt/python/run/venv/lib/python2.7/site-packages',
 '/opt/python/current/app',
 '',
 '/opt/python/run/baselinenv/local/lib64/python2.7/site-packages',
 '/opt/python/run/baselinenv/local/lib/python2.7/site-packages',
 '/opt/python/run/baselinenv/lib64/python2.7',
 '/opt/python/run/baselinenv/lib/python2.7',
 '/opt/python/run/baselinenv/lib64/python2.7/site-packages',
 '/opt/python/run/baselinenv/lib/python2.7/site-packages',
 '/opt/python/run/baselinenv/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7',
 '/usr/lib/python2.7']

我已经做了pip安装pandas,它说我已经满足了要求。

2 个答案:

答案 0 :(得分:1)

让pandas在aws中运行是非常复杂的,但是因为你试图从你自己的api中检索数据,我认为它存在于models.py中并且所有数据都已存在。因此你可以。

a = yourObject.objects.all()
#Make a list to contains all the object
listAttribute1 = []
listAttrubute2 = []
for x in a:
    listAttribute1.append(x.yourattribute1)
    listAttribute2.append(x.yourattribute2)

因此,您可以通过这种方式从api中检索数据而不使用pandas。有关更多信息。

点击此处。

http://blog.etianen.com/blog/2013/06/08/django-querysets/

答案 1 :(得分:0)

我认为你使用的是python虚拟环境而不是默认环境。确保在激活虚拟环境后安装任何内容时。

you$ source /opt/python/run/venv/bin/activate
(venv)you$ pip install pandas
祝你好运!