windows环境下 pip 安装 seaborn 失败?

来源:互联网 发布:python 图片相似度 库 编辑:程序博客网 时间:2024/06/13 23:45

matploatlib 包很强大,但对于需要快速做一些基础图形的朋友来说 界面似乎有点简陋,基于matploatlib 开发seaborn 包 显得更好看一些,这点我很喜欢

这次安装并不是那么顺利,我想一定有不少朋友会也会遇到,为了避免大家再绕弯路,特写了这片日志。


seaborn 依赖 matploatlib、numpy、 scripy、pandas


我的python版本是2.7 64bit ,系统win7 64bit

 由于默认python exe包并没有增加环境变量到系统中去,我一般是到python 目录中执行

cd C:\Python27


前两个依赖好说, 一条命令即可;

python.exe -m pip install matploatlib 

python.exe -m pip install numpy



python.exe -m pip install seaborn 

seaborn  会自动安装依赖 scripy, 但是pip 库中好像并没有所需要的dll库 导致报错,不得不说pip这方面 做的还是弱了点...


        import numpy.core.numeric as _nx
      File "C:\Python27\lib\site-packages\numpy\core\__init__.py", line 14, in <
module>
        from . import multiarray
    ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。


    ----------------------------------------
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\
\users\\han~1.chu\\appdata\\local\\temp\\pip-build-mr3y1y\\scipy\\setup.py';f=ge
tattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.cl
ose();exec(compile(code, __file__, 'exec'))" install --record c:\users\han~1.chu
\appdata\local\temp\pip-bgtjdm-record\install-record.txt --single-version-extern
ally-managed --compile" failed with error code 1 in c:\users\han~1.chu\appdata\l
ocal\temp\pip-build-mr3y1y\scipy\


这时候我们需要做的是手动下载whl文件 然后用pip 安装.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

下载对应版本的,pytho2还是python3 64bit还是32bit 一定要对上(以当前安装的python版本为准)。

下载下来的whl我放进了python目录 然后执行下列操作。

C:\Python27>python.exe -m pip install scipy-0.18.1-cp27-cp27m-win_amd64.whl
Processing c:\python27\scipy-0.18.1-cp27-cp27m-win_amd64.whl
Installing collected packages: scipy
Successfully installed scipy-0.18.1


C:\Python27>python.exe -m pip install seaborn
Collecting seaborn
  Using cached seaborn-0.7.1.tar.gz
Requirement already satisfied: numpy in c:\python27\lib\site-packages (from seab
orn)
Requirement already satisfied: scipy in c:\python27\lib\site-packages (from seab
orn)
Requirement already satisfied: matplotlib in c:\python27\lib\site-packages (from
 seaborn)
Requirement already satisfied: pandas in c:\python27\lib\site-packages (from sea
born)
Requirement already satisfied: cycler in c:\python27\lib\site-packages (from mat
plotlib->seaborn)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,>=1.5.6 in c:\python27\l
ib\site-packages (from matplotlib->seaborn)
Requirement already satisfied: pytz in c:\python27\lib\site-packages (from matpl
otlib->seaborn)
Requirement already satisfied: python-dateutil in c:\python27\lib\site-packages
(from matplotlib->seaborn)
Requirement already satisfied: six in c:\python27\lib\site-packages (from cycler
->matplotlib->seaborn)
Installing collected packages: seaborn
  Running setup.py install for seaborn ... done
Successfully installed seaborn-0.7.1


OK, 这样我们就安装完成了.....  希望以后大家遇到类似的问题 可以举一反三。

当然 Anaconda 也是一个不错的集体环境, 科学运算方面的包比较齐全,不喜欢麻烦的朋友也可以去下载安装。 






0 0