我正在尝试使用我在Apache Web服务器上运行的简单Python脚本导入pandas。出于某种原因,大熊猫没有导入。当我查看Apache错误日志时,看起来错误实际上来自导入matplotlib:
Premature end of script headers: hello_advanced.cgi
Traceback (most recent call last):\r
File "C:/OSGeo4W/apache/cgi-bin/hello_advanced.cgi", line 14, in <module>\r
import pandas\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\pandas\\__init__.py", line 40, in <module>\r
from pandas.core.api import *\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\pandas\\core\\api.py", line 12, in <module>\r
from pandas.core.series import Series, TimeSeries\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\pandas\\core\\series.py", line 2617, in <module>\r
import pandas.tools.plotting as _gfx\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\pandas\\tools\\plotting.py", line 23, in <module>\r
import pandas.tseries.converter as conv\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\pandas\\tseries\\converter.py", line 7, in <module>\r
import matplotlib.units as units\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\matplotlib\\__init__.py", line 947, in <module>\r
rcParams = rc_params()\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\matplotlib\\__init__.py", line 856, in rc_params\r
fname = matplotlib_fname()\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\matplotlib\\__init__.py", line 726, in matplotlib_fname\r
configdir = _get_configdir()\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\matplotlib\\__init__.py", line 597, in _get_configdir\r
return _get_config_or_cache_dir(_get_xdg_config_dir())\r
File "C:\\Python27\\Anaconda\\lib\\site-packages\\matplotlib\\__init__.py", line 534, in _get_xdg_config_dir\r
return os.environ.get('XDG_CONFIG_HOME', os.path.join(get_home(), '.config'))\r
File "C:\\Python27\\Anaconda\\lib\\ntpath.py", line 96, in join\r
assert len(path) > 0\r
TypeError: object of type 'NoneType' has no len()\r
我很感激为什么会发生这种情况以及如何解决它。我可以重做脚本以避免大熊猫,但我不希望每次出现导入错误时都这样做。