Ошибка при импорте pandas в Apache
В Apache при импорте pandas из /cgi-bin/st.py получаю ошибку RuntimeError: Can't determine home directory
При использовании http.server.ThreadingHTTPServer вместо Apache, все работает.
Как избавиться от ошибки?
C:\Apache24\cgi-bin\st.py in <module>
...
=> 31 import lib_new.te
...
c:\Apache24\lib_new\te.py in <module>
11
12 import bs4
=> 13 import pandas
14 import requests
15
pandas undefined
C:\Python38\lib\site-packages\pandas\__init__.py in <module>
53 import pandas.core.config_init
54
=> 55 from pandas.core.api import (
=> 56 # dtype
=> 57 Int8Dtype,
pandas = <module 'pandas' from 'C:\\Python38\\lib\\site-packages\\pandas\\__init__.py'>, pandas.core = <module 'pandas.core' from 'C:\\Python38\\lib\\site-packages\\pandas\\core\\__init__.py'>, pandas.core.api undefined, Int8Dtype undefined, Int16Dtype undefined, Int32Dtype undefined, Int64Dtype undefined, UInt8Dtype undefined, UInt16Dtype undefined, UInt32Dtype undefined, UInt64Dtype undefined, CategoricalDtype undefined, PeriodDtype undefined, IntervalDtype undefined, DatetimeTZDtype undefined, isna undefined, isnull undefined, notna undefined, notnull undefined, Index undefined, CategoricalIndex undefined, Int64Index undefined, UInt64Index undefined, RangeIndex undefined, Float64Index undefined, MultiIndex undefined, IntervalIndex undefined, TimedeltaIndex undefined, DatetimeIndex undefined, PeriodIndex undefined, IndexSlice undefined, NaT undefined, Period undefined, period_range undefined, Timedelta undefined, timedelta_range undefined, Timestamp undefined, date_range undefined, bdate_range undefined, Interval undefined, interval_range undefined, DateOffset undefined, to_numeric undefined, to_datetime undefined, to_timedelta undefined, np undefined, Grouper undefined, factorize undefined, unique undefined, value_counts undefined, NamedAgg undefined, array undefined, Categorical undefined, set_eng_float_format undefined, Series undefined, DataFrame undefined
C:\Python38\lib\site-packages\pandas\core\api.py in <module>
22 )
23 from pandas.core.arrays import Categorical, array
=> 24 from pandas.core.groupby import Grouper, NamedAgg
25 from pandas.io.formats.format import set_eng_float_format
26 from pandas.core.index import (
pandas undefined, Grouper undefined, NamedAgg undefined
C:\Python38\lib\site-packages\pandas\core\groupby\__init__.py in <module>
=> 1 from pandas.core.groupby.generic import ( # noqa: F401
=> 2 DataFrameGroupBy,
=> 3 NamedAgg,
=> 4 SeriesGroupBy,
=> 5 )
pandas undefined, DataFrameGroupBy undefined, NamedAgg undefined, SeriesGroupBy undefined
C:\Python38\lib\site-packages\pandas\core\groupby\generic.py in <module>
42 from pandas.core.base import DataError, SpecificationError
43 import pandas.core.common as com
=> 44 from pandas.core.frame import DataFrame
45 from pandas.core.generic import ABCDataFrame, ABCSeries, NDFrame, _shared_docs
46 from pandas.core.groupby import base
pandas undefined, DataFrame undefined
C:\Python38\lib\site-packages\pandas\core\frame.py in <module>
113 )
114 from pandas.core.ops.missing import dispatch_fill_zeros
=> 115 from pandas.core.series import Series
116
117 from pandas.io.formats import console, format as fmt
pandas undefined, Series undefined
C:\Python38\lib\site-packages\pandas\core\series.py in <module>
82
83 import pandas.io.formats.format as fmt
=> 84 import pandas.plotting
85
86 __all__ = ["Series"]
pandas undefined
C:\Python38\lib\site-packages\pandas\plotting\__init__.py in <module>
57 https://github.com/pandas-dev/pandas/issues/26747.
58 """
=> 59 from pandas.plotting._core import (
=> 60 PlotAccessor,
=> 61 boxplot,
pandas undefined, PlotAccessor undefined, boxplot undefined, boxplot_frame undefined, boxplot_frame_groupby undefined, hist_frame undefined, hist_series undefined
C:\Python38\lib\site-packages\pandas\plotting\_core.py in <module>
15 # we can lazily import matplotlib.
16 try:
=> 17 import pandas.plotting._matplotlib # noqa
18 except ImportError:
19 pass
pandas = <module 'pandas' from 'C:\\Python38\\lib\\site-packages\\pandas\\__init__.py'>, pandas.plotting undefined
C:\Python38\lib\site-packages\pandas\plotting\_matplotlib\__init__.py in <module>
1 from pandas._config import get_option
2
=> 3 from pandas.plotting._matplotlib.boxplot import (
=> 4 BoxPlot,
=> 5 boxplot,
pandas undefined, BoxPlot undefined, boxplot undefined, boxplot_frame undefined, boxplot_frame_groupby undefined
C:\Python38\lib\site-packages\pandas\plotting\_matplotlib\boxplot.py in <module>
12 from pandas.io.formats.printing import pprint_thing
13 from pandas.plotting._matplotlib import converter
=> 14 from pandas.plotting._matplotlib.core import LinePlot, MPLPlot
15 from pandas.plotting._matplotlib.style import _get_standard_colors
16 from pandas.plotting._matplotlib.tools import _flatten, _subplots
pandas undefined, LinePlot undefined, MPLPlot undefined
C:\Python38\lib\site-packages\pandas\plotting\_matplotlib\core.py in <module>
32 from pandas.plotting._matplotlib.compat import _mpl_ge_3_0_0
33 from pandas.plotting._matplotlib.style import _get_standard_colors
=> 34 from pandas.plotting._matplotlib.tools import (
=> 35 _flatten,
=> 36 _get_all_lines,
pandas undefined, _flatten undefined, _get_all_lines undefined, _get_xlim undefined, _handle_shared_axes undefined, _subplots undefined, format_date_labels undefined, table undefined
C:\Python38\lib\site-packages\pandas\plotting\_matplotlib\tools.py in <module>
3 import warnings
4
=> 5 import matplotlib.table
6 import matplotlib.ticker as ticker
7 import numpy as np
matplotlib undefined
C:\Python38\lib\site-packages\matplotlib\table.py in <module>
23 from .artist import Artist, allow_rasterization
24 from .patches import Rectangle
=> 25 from .text import Text
26 from .transforms import Bbox
27 from .path import Path
Text undefined
C:\Python38\lib\site-packages\matplotlib\text.py in <module>
12 from . import artist, cbook, docstring, rcParams
13 from .artist import Artist
=> 14 from .font_manager import FontProperties
15 from .lines import Line2D
16 from .patches import FancyArrowPatch, FancyBboxPatch, Rectangle
FontProperties undefined
C:\Python38\lib\site-packages\matplotlib\font_manager.py in <module>
101
102 MSUserFontDirectories = [
=> 103 os.path.join(str(Path.home()), r'AppData\Local\Microsoft\Windows\Fonts'),
104 os.path.join(str(Path.home()), r'AppData\Roaming\Microsoft\Windows\Fonts')]
105
os = <module 'os' from 'C:\\Python38\\lib\\os.py'>, os.path = <module 'ntpath' from 'C:\\Python38\\lib\\ntpath.py'>, os.path.join = <function join>, builtin str = <class 'str'>, Path = <class 'pathlib.Path'>, Path.home = <bound method Path.home of <class 'pathlib.Path'>>
C:\Python38\lib\pathlib.py in home(cls=<class 'pathlib.Path'>)
1094 returned by os.path.expanduser('~')).
1095 """
=> 1096 return cls(cls()._flavour.gethomedir(None))
1097
1098 def samefile(self, other_path):
cls = <class 'pathlib.Path'>, )._flavour undefined
C:\Python38\lib\pathlib.py in gethomedir(self=<pathlib._WindowsFlavour object>, username=None)
265 userhome = drv + os.environ['HOMEPATH']
266 else:
=> 267 raise RuntimeError("Can't determine home directory")
268
269 if username:
builtin RuntimeError = <class 'RuntimeError'>
RuntimeError: Can't determine home directory
args = ("Can't determine home directory",)
with_traceback = <built-in method with_traceback of RuntimeError object>