Python CGI脚本"无法分配内存"导入错误

时间:2016-09-14 07:50:21

标签: python pandas

我在共享的64位Ubuntu托管环境中有一个简单的CGI脚本。

#!/kunden/homepages/14/d156645139/htdocs/htdocs/anaconda2/bin/python
# -*- coding: UTF-8 -*-

import sys
import cgi
import cgitb
cgitb.enable()
import numpy
from pandas_datareader.yahoo.daily import YahooDailyReader

当我尝试运行脚本时,收到以下错误:

 /kunden/homepages/14/d156645139/htdocs/finance/bin/py/test.py in ()
      6 import cgitb
      7 cgitb.enable()
=>    8 from pandas_datareader.yahoo.daily import YahooDailyReader
      9 import datetime as dt
     10 import numpy as np
pandas_datareader undefined, YahooDailyReader undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas_datareader/yahoo/daily.py in ()
      2 
      3 
      4 class YahooDailyReader(_DailyBaseReader):
      5 
      6     """
pandas_datareader undefined, _DailyBaseReader undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas_datareader/base.py in ()
      7 from requests_file import FileAdapter
      8 
=>    9 from pandas import to_datetime
     10 import pandas.compat as compat
     11 from pandas.core.common import PandasError, is_number
pandas undefined, to_datetime undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas/__init__.py in ()
     35 
     36 # let init-time option registration happen
=>   37 import pandas.core.config_init
     38 
     39 from pandas.core.api import *
pandas undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas/core/config_init.py in ()
     16                                 is_one_of_factory, get_default_val,
     17                                 is_callable)
=>   18 from pandas.formats.format import detect_console_encoding
     19 
     20 #
pandas undefined, detect_console_encoding undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas/formats/format.py in ()
     19 import pandas.lib as lib
     20 from pandas.tslib import iNaT, Timestamp, Timedelta, format_array_from_datetime
=>   21 from pandas.tseries.index import DatetimeIndex
     22 from pandas.tseries.period import PeriodIndex
     23 import pandas as pd
pandas undefined, DatetimeIndex undefined
 /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas/tseries/index.py in ()
<type 'exceptions.ImportError'>: /kunden/homepages/14/d156645139/htdocs/anaconda2/lib/python2.7/site-packages/pandas/_period.so: failed to map segment from shared object: Cannot allocate memory 
      args = ('/kunden/homepages/14/d156645139/htdocs/anaconda2...egment from shared object: Cannot allocate memory',) 
      message = '/kunden/homepages/14/d156645139/htdocs/anaconda2...egment from shared object: Cannot allocate memory'

如何追踪内存错误的来源?例如,有没有办法了解内存限制甚至增加?

1 个答案:

答案 0 :(得分:0)

我能够将机器的RAM增加到保证的2GB,从而解决了这个问题。