如何在windows下安装matplotlib

1. 安装python-2.7.9.amd64版本,好像只有2.7.9版本才支持pip

2.      注册python到注册表

#
# script to register Python 2.0 or later for use with
# Python extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html

import sys

from _winreg import *

# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix

regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
    installpath, installpath, installpath
)

def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError as e:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print "*** Unable to register!"
            return
        print "--- Python", version, "is now registered!"
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print "=== Python", version, "is already registered!"
        return
    CloseKey(reg)
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"

if __name__ == "__main__":
    RegisterPy()


3.   安装 numpy-1.7.0-win32-superpack-python2.7.exe

4. 下载numpy-1.9.2+mkl-cp27-none-win_amd64.whl文件,通过   pip install numpy-1.9.2+mkl-cp27-none-win_amd64.whl

5. 安装python_dateutil-2.4.2-py2.py3-none-any.whl  , 下载文件,然后到相应的目录pip install  python_dateutil-2.4.2-py2.py3-none-any.whl

6. 安装 pyparsing-2.0.3-py2-none-any.whl  下载文件,然后到相应的目录pip install  pyparsing-2.0.3-py2-none-any.whl 

7. 安装scipy  ,直接通过安装文件安装。 scipy_0.14.0.win_amd64_py2.7.exe

   在这里下载http://download.csdn.net/detail/z1102252970/8194609        win64 python2.7+numpy+scipy找了好久才整理出来的

8、输入以下代码不报错:
import matplotlib
import numpy
import scipy
import pyparsing
import matplotlib.pyplot as plt

9、验证一个简单的例子
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()

======================================


也可以直接安装Anaconda,以上所有步骤都省了,一步到位。

http://www.gimoo.net/t/1405/541f9dd1d0a5d.html


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值