``` Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/matplotlib/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read() --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/matplotlib Traceback (most recent call last): File "/usr/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/local/python27/lib/python2.7/site-packages/pip/__init__.py", line 185, in main return command.main(cmd_args) File "/usr/local/python27/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 105: ordinal not in range(128) ```
3. 下载源码解压后用 Python setup.py install 安装报如下错误:
building 'matplotlib._png' extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib__png_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/python27/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -I/usr/include -I. -I/usr/include/libpng12 -I/usr/local/python27/include/python2.7 -c src/_png.cpp -o build/temp.linux-x86_64-2.7/src/_png.o In file included from /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1804, from /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, from /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from src/_png.cpp:28: /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" src/_png.cpp:243:48: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given src/_png.cpp:264:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given src/_png.cpp:577:44: error: macro "npy_PyFile_DupClose" requires 3 arguments, but only 2 given In file included from src/file_compat.h:4, from src/_png.cpp:31: /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ?.yObject* npy_PyFile_OpenFile(PyObject*, const char*)?. /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h:348: warning: deprecated conversion from string constant to ?.har*? /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h: In function ?.nt npy_PyFile_CloseFile(PyObject*)?. /usr/local/python27/lib/python2.7/site-packages/numpy/core/include/numpy/npy_3kcompat.h:356: warning: deprecated conversion from string constant to ?.har*? src/_png.cpp: In member function ?.y::Object _png_module::write_png(const Py::Tuple&)?. src/_png.cpp:243: error: ?.py_PyFile_DupClose?.was not declared in this scope src/_png.cpp:264: error: ?.py_PyFile_DupClose?.was not declared in this scope src/_png.cpp: In member function ?.yObject* _png_module::_read_png(const Py::Object&, bool, int)?. src/_png.cpp:329: warning: deprecated conversion from string constant to ?.har*? src/_png.cpp:577: error: ?.py_PyFile_DupClose?.was not declared in this scope error: command 'gcc' failed with exit status 1