熊猫Seaborn安装

use*_*230 9 python-2.7 pandas seaborn

在运行Python 2.7的Ubuntu 12.04 LTS上,我试图将看起来很棒的Seaborn绘图包添加到我现有的运行良好的Pandas环境中,从而出现安装错误.

这是控制台中包含错误的片段:

~$ pip install seaborn
running install_lib

creating /usr/local/lib/python2.7/dist-packages/seaborn

error: could not create '/usr/local/lib/python2.7/dist-packages/seaborn': 
Permission denied
Run Code Online (Sandbox Code Playgroud)
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tm/pip_build_moj0/seaborn/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-LvVao5-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_mojo/seaborn
Storing debug log for failure in /home/mojo/.pip/pip.log
Run Code Online (Sandbox Code Playgroud)

任何人都有Seaborn github网站上没有的解决方案提示?

And*_*den 8

我认为最简单的方法是使用sudo:

sudo pip install seaborn
Run Code Online (Sandbox Code Playgroud)

它需要sudo权限才能写入usr/local/lib.

注意:如果你正在使用anaconda,你将不需要sudo通过pip安装,一旦你的conda安装了pip,虽然seaborn也可以通过conda.


Emr*_*mre 6

个人安装是一个很好的习惯:

pip install --user seaborn

然而,有一个更简单的方法:编写python时,XY维护最新的pandas seaborn(以及其他有用的包),所以你要做的就是

sudo add-apt-repository ppa:pythonxy/pythonxy-devel
sudo apt-get update
sudo apt-get install python-seaborn python-pandas
Run Code Online (Sandbox Code Playgroud)

请注意,这只适用于python 2.x; 你仍然需要pip3安装python 3.x软件包.