本文介绍了无法导入 seaborn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在导入 seaborn 时遇到问题.我最近在我的 PC 上安装了anaconda"并尝试使用 seaborn pacjesge.我更新了 scipynumpy.实际上在更新 scipy 之前,python 看不到 seaborn.什么是问题?请帮帮我

I have a problem with importing seaborn. I recently installed "anaconda" on my PC and tried to use seaborn pacjesge. I updated scipy and numpy. Actually before updating scipy python couldn't see seaborn. What is problem? Please help me

Python 2.7.10 |Anaconda 2.3.0 (64-bit)| (default, May 28 2015, 17:02:03) 
Type "copyright", "credits" or "license" for more information.

IPython 3.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import seaborn as sns
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-ed9806ce3570> in <module>()
----> 1 import seaborn as sns

~/anaconda/lib/python2.7/site-packages/seaborn/__init__.py in <module>()
----> 1 from .rcmod import *
      2 from .utils import *
      3 from .palettes import *
      4 from .linearmodels import *
      5 from .categorical import *
~/anaconda/lib/python2.7/site-packages/seaborn/rcmod.py in <module>()
      1 """Functions that alter the matplotlib rc dictionary on the fly."""
----> 2 import numpy as np
      3 import matplotlib as mpl
      4 
      5 from . import palettes

~/anaconda/lib/python2.7/site-packages/numpy/__init__.py in <module>()
    178         return loader(*packages, **options)
    179 
--> 180     from . import add_newdocs
    181     __all__ = ['add_newdocs',
    182                'ModuleDeprecationWarning',

~/anaconda/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
     11 from __future__ import division, absolute_import, print_function
     12 
---> 13 from numpy.lib import add_newdoc
     14 
     15 ###############################################################################

~/anaconda/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
      6 from numpy.version import version as __version__
      7 
----> 8 from .type_check import *
      9 from .index_tricks import *
     10 from .function_base import *
~/anaconda/lib/python2.7/site-packages/numpy/lib/type_check.py in <module>()
      9            'common_type']
     10 
---> 11 import numpy.core.numeric as _nx
     12 from numpy.core.numeric import asarray, asanyarray, array, isnan, \
     13                 obj2sctype, zeros
~/anaconda/lib/python2.7/site-packages/numpy/core/__init__.py in <module>()
     12 if 'GOTOBLAS_MAIN_FREE' not in os.environ:
     13     os.environ['GOTOBLAS_MAIN_FREE'] = '1'
---> 14 from . import multiarray
     15 os.environ.clear()
     16 os.environ.update(envbak)

ImportError: libopenblas.so.0: cannot open shared object file: No such file or directory

In [2]: 

推荐答案

这终于在 mac 上对我有用了.

This finally worked for me on mac.

  1. 在终端类型:iPython 并按回车
  2. 应该出现交互式 python 终端

  1. in terminal type: iPython and hit return
  2. the interactive python terminal should appear

IPython 4.1.2 -- 增强的交互式 Python.?-> IPython 特性的介绍和概述.%quickref -> 快速参考.help -> Python 自己的帮助系统.目的?-> 有关对象"的详细信息,请使用对象??"了解更多详情.

IPython 4.1.2 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.

在 [1] 中:

输入:!pip install Seaborn

type: !pip install Seaborn

你应该看到:成功构建 Seaborn安装收集的软件包:Seaborn成功安装 Seaborn-0.7.1

You should see: Successfully built Seaborn Installing collected packages: Seaborn Successfully installed Seaborn-0.7.1

也可以尝试 (!conda 而不是 !pip),但 !pip 对我有用.然后我尝试在具有import Seaborn"的 iPython notebook 中运行单元格并且它工作正常.

Can also try (!conda instead of !pip) but !pip worked for me. Then I tried running the cell in iPython notebook that had "import Seaborn" and it worked.

这篇关于无法导入 seaborn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:05