在安装matplotlib环境时遇到了无数坑爹问题,汇总一下..希望给迷路的同学提供帮助..
0x00
Traceback (most recent call last):
File "
import matplotlib
File "D:\Python27\lib\site-packages\matplotlib\__init__.py", line xx, in
raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires six
easy_install six
0x01
Traceback (most recent call last):
File "
import matplotlib
File "D:\Python27\lib\site-packages\matplotlib\__init__.py", line 111, in
raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil
easy_install dateutil会安装失败,应该输入easy_install python-dateutil
0x02
Traceback (most recent call last):
File "
import matplotlib
File "E:\Python 2.7.9\lib\site-packages\matplotlib\__init__.py", line 140, in
raise ImportError("matplotlib requires pyparsing")
ImportError: matplotlib requires pyparsing
easy_install pyparsing
0x03
Traceback (most recent call last):
File "
import matplotlib
File "E:\Python 2.7.9\lib\site-packages\matplotlib\__init__.py", line 180, in
from matplotlib.cbook import is_string_like
File "E:\Python 2.7.9\lib\site-packages\matplotlib\cbook.py", line 33, in
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即可
终于,大功告成!