Matplotlib坑爹依赖安装全解

在安装matplotlib环境时遇到了无数坑爹问题,汇总一下..希望给迷路的同学提供帮助..


0x00

Traceback (most recent call last):

  File "<pyshell#0>", line 1, in <module>

    import matplotlib

  File "D:\Python27\lib\site-packages\matplotlib\__init__.py", line xx, in <module>

    raise ImportError("matplotlib requires dateutil")

ImportError: matplotlib requires six

easy_install six


0x01

Traceback (most recent call last):

  File "<pyshell#0>", line 1, in <module>

    import matplotlib

  File "D:\Python27\lib\site-packages\matplotlib\__init__.py", line 111, in <module>

    raise ImportError("matplotlib requires dateutil")

ImportError: matplotlib requires dateutil

easy_install dateutil会安装失败,应该输入easy_install python-dateutil


0x02

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import matplotlib
  File "E:\Python 2.7.9\lib\site-packages\matplotlib\__init__.py", line 140, in <module>
    raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing

easy_install pyparsing


0x03

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import matplotlib
  File "E:\Python 2.7.9\lib\site-packages\matplotlib\__init__.py", line 180, in <module>
    from matplotlib.cbook import is_string_like
  File "E:\Python 2.7.9\lib\site-packages\matplotlib\cbook.py", line 33, in <module>
    import numpy as np
ImportError: No module named numpy

在有VS2012或者2011的环境下,easy_install numpy会提示Unable to find vcvarsall.bat,因为Python27默认编译器为vs2008,若环境中存在VS2012输入SET VS90COMNTOOLS=%VS110COMNTOOLS%;若环境为VS2010则输入SET VS90COMNTOOLS=%VS100COMNTOOLS%后,再进行easy_install numpy

若仍报错,直接http://sourceforge.net/projects/numpy/files找相应版本下载numpy.exe后安装即可


0x04

pip出现Fatal error in launcher:unable to create process using xxx


在系统变量加入python目录后执行python -m pip install xxx


0x05

如果你的python是64位的,0x04红色字体方法不可行,需要下载64位的numpy,

在http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy下载64位numpy.whl之后,切换到下载目录,pip install numpyxxx.whl即可

终于,大功告成!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值