我正在尝试在Jupyter笔记本中导入seaborn以便绘制一些绘图,但是以某种方式它给了我一个错误。 我正在尝试使用以下代码导入seaborn:
!conda install -c anaconda seaborn --yes
import seaborn as sns
print('Seaborn installed and imported!')
但是它给了我以下错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-64-e46449d32a66> in <module>
5 # import library
6
----> 7 import seaborn as sns
8
9 print('Seaborn installed and imported!')
~/conda/envs/python/lib/python3.6/site-packages/seaborn/__init__.py in <module>
7 from .utils import *
8 from .palettes import *
----> 9 from .relational import *
10 from .regression import *
11 from .categorical import *
~/conda/envs/python/lib/python3.6/site-packages/seaborn/relational.py in <module>
16 from .algorithms import bootstrap
17 from .palettes import color_palette, cubehelix_palette, _parse_cubehelix_args
---> 18 from .axisgrid import FacetGrid, _facet_docs
19
20
~/conda/envs/python/lib/python3.6/site-packages/seaborn/axisgrid.py in <module>
14 from .palettes import color_palette, blend_palette
15 from .external.six import string_types
---> 16 from .distributions import distplot, kdeplot, _freedman_diaconis_bins
17
18
~/conda/envs/python/lib/python3.6/site-packages/seaborn/distributions.py in <module>
14
15 try:
---> 16 import statsmodels.nonparametric.api as smnp
17 _has_statsmodels = True
18 except ImportError:
~/conda/envs/python/lib/python3.6/site-packages/statsmodels/nonparametric/__init__.py in <module>
5 """
6
----> 7 from statsmodels.tools._testing import PytestTester
8
9 test = PytestTester()
~/conda/envs/python/lib/python3.6/site-packages/statsmodels/tools/__init__.py in <module>
----> 1 from .tools import add_constant, categorical
2 from statsmodels.tools._testing import PytestTester
3
4 __all__ = ['test', 'add_constant', 'categorical']
5
~/conda/envs/python/lib/python3.6/site-packages/statsmodels/tools/tools.py in <module>
3 '''
4 import numpy as np
----> 5 import numpy.lib.recfunctions as nprf
6 import numpy.linalg as L
7 import pandas as pd
~/conda/envs/python/lib/python3.6/site-packages/numpy/lib/recfunctions.py in <module>
14 from numpy import ndarray, recarray
15 from numpy.ma import MaskedArray
---> 16 from numpy.ma.mrecords import MaskedRecords
17 from numpy.lib._iotools import _is_string_like
18 from numpy.compat import basestring
~/conda/envs/python/lib/python3.6/site-packages/numpy/ma/mrecords.py in <module>
30
31 _byteorderconv = np.core.records._byteorderconv
---> 32 _typestr = ntypes._typestr
33
34 import numpy.ma as ma
AttributeError: module 'numpy.core.numerictypes' has no attribute '_typestr'
我尝试安装seaborn,升级seabonr,安装numpy,升级numpy,但到目前为止没有任何效果。