centos7 安装 matplotlib和numpy

来源:互联网 发布:批发源码 编辑:程序博客网 时间:2024/06/05 06:56

自己在网上买了一个云服务器,在安装matplotlib和numpy方面花了不少力气,以下也是在网上找到的教程。
我仅作为搬运,亲测没有问题,希望对大家有用。

安装 matplotlib

1.yum search matplotlib
返回结果是:
[root@dn1 Desktop]# yum search matplotlib
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.NET
* extras: mirrors.btte.Net
* updates: mirrors.skyshe.cn
=========================== N/S matched: matplotlib ============================
Python-matplotlib-doc.x86_64 : Documentation files for python-matplotlib
python-matplotlib-qt4.x86_64 : Qt4 backend for python-matplotlib
python-matplotlib-tk.x86_64 : Tk backend for python-matplotlib
python-matplotlib.x86_64 : Python 2D plotting library

选择最下方的那个,安装
2.yum install python-matplotlib.x86_64
它会把一切依赖给你装上。完毕。

安装numpy

安装相关工具。

[root@localhostmyhaspl]# yum install wget

[root@localhostmyhaspl]# yum install unzip

[root@localhostmyhaspl]# yum install gcc

[root@localhostnumpy-1.9.0]# yum install Python-devel

1、下载numpy源码并解压。

[root@localhostmyhaspl]# wget http://jaist.dl.sourceforge.NET/project/numpy/NumPy/1.9.0/numpy-1.9.0.zip

2、安装numpy。

[root@localhostmyhaspl]# unzip numpy-1.9.0.zip

[root@localhostmyhaspl]# cd numpy-1.9.0

[root@localhostnumpy-1.9.0]# python setup.py install

3、安装完毕后,重启 。

[root@localhostnumpy-1.9.0]# reboot

4、测试是否安装成功,如果能导入numpy库,表示安装成功。

[myhaspl@localhost~]$ python

Python2.7.5 (default, Jun 17 2014, 18:11:42)

[GCC4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2

Type”help”, “copyright”, “credits” or”license” for more information.

import numpy as np

参考:
[1] http://blog.csdn.net/vickyrocker1/article/details/49070733
[2] http://blog.csdn.net/genghaihua/article/details/44305949