开发者

How to install matplotlib without gcc errors?

I downloaded the source and untarred it.

sudo python setup.py install

And below are the errors I get. By the way, Numpy is installed.

src/_image.cpp:5:17: error: png.h: No such file or directory
src/_image.cpp: In member function 'Py::Object Image::write_png(const Py::Tuple&)':
src/_image.cpp:646: error: 'png_structp' was not declared in this scope
src/_image.cpp:646: error: expected `;' before 'png_ptr'
src/_image.cpp:647: error: 'png_infop' was not declared in this scope
src/_image.cpp:647: error: expected `;' before 'info_ptr'
src/_image.cpp:648: error: aggregate 'png_color_8_struct sig_bit' has incomplete type and cannot be defined
src/_image.cpp:649: error: 'png_uint_32' was not declared in this scope
src/_image.cpp:649: error: expected `;' before 'row'
src/_image.cpp:652: error: 'png_bytep' was not declared in this scope
src/_image.cpp:652: error: 'row_pointers' was not declared in this scope
src/_image.cpp:652: error: expected type-specifier before 'png_bytep'
src/_image.cpp:652: error: expected `;' before 'png_bytep'
src/_image.cpp:654: error: 'row' was not declared in this scope
src/_image.cpp:660: error: type '<type error>' argument given to 'delete', expected pointer
src/_image.cpp:665: error: 'png_ptr' was not declared in this scope
src/_image.cpp:665: error: 'PNG_LIBPNG_VER_STRING' was not declared in this scope
src/_image.cpp:665: error: 'png_create_write_struct' was not declared in this scope
src/_image.cpp:669: error: type '<type error>' argument given to 'delete', expected pointer
src/_image.cpp:673: error: 'info_ptr' was not declared in this scope
src/_image.cpp:673: error: 'png_create_info_struct' was not declared in this scope
src/_image.cpp:677: error: 'png_destroy_write_struct' was not declared in this scope
src/_image.cpp:678: error: type '<type error>' argument given to 'delete', expected pointer
src/_image.cpp:685: error: 'png_destroy_write_struct' was not declared in this scope
src/_image.cpp:686: error: type '<type error>' argument given to 'delete', expected pointer
src/_image.cpp:690: error: 'png_init_io' was not declared in this scope
src/_image.cpp:693: error: 'PNG_COLOR_TYPE_RGB_ALPHA' was not declared in this scope
src/_image.cpp:693: error: 'PNG_INTERLACE_NONE' was not declared in this scope
src/_image.cpp:694: error: 'PNG_COMPRESSION_TYPE_BASE' was not declared in this scope
src/_image.cpp:694: error: 'PNG_FILTER_TYPE_BASE' was not declared in this scope
src/_image.cpp:694: error: 'png_set_IHDR' was not declared in this scope
src/_image.cpp:703: error: 'png_set_sBIT' was not declared in this scope
src/_image.cpp:705: error: 'png_write_info' was not declared in this scope
src/_image.cpp:706: error: 'png_write_image' was not declared in this scope
src/_image.cpp:707: error: 'png_write_end' was not declared in this scope
src/_image.cpp:708: error: 'png_destroy_write_struct' was not declared in this scope
src/_image.cpp:711: error: type '<type error>' argument given to 'delete', expected pointer
src/_image.cpp: In member function 'Py::Object _image_module::readpng(const Py::Tuple&)':
src/_image.cpp:860: error: 'png_byte' was not declared in this scope
src/_image.cpp:860: error: expected `;' before 'header'
src/_image.cpp:866: error: 'header' was not declared in this scope
src/_image.cpp:868: error: 'header' was not declared in this scope
src/_image.cpp:868: error: 'png_sig_cmp' was not declared in this scope
src/_image.cpp:873: error: 'png_structp' was not declared in this scope
src/_image.cpp:873: error: expected `;' before 'png_ptr'
src/_image.cpp:875: error: 'png_ptr' was not declared in this scope
src/_image.cpp:878: error: 'png_infop' was not declared in this scope
src/_image.cpp:878: error: expected `;' before 'info_ptr'
src/_image.cpp:879: error: 'info_ptr' was not declared in this scope
src/_image.cpp:882: error: 'png_ptr' was not declared in this scope
src/_image.cpp:882: error: 'png_jmpbuf' was not declared in this scope
src/_image.cpp:885: error: 'png_ptr' was not declared in this scope
src/_image.cpp:885: error: 'png_init_io' was not declared in this scope
src/_image.cpp:886: error: 'png_set_sig_bytes' was not declared in this scope
src/_image.cpp:888: error: 'info_ptr' was not declared in this scope
src/_image.cpp:888: error: 'png_read_info' was not declared in this scope
src/_image.cpp:890: error: 'png_uint_32' was not declared in this scope
src/_image.cpp:890: error: expected `;' before 'width'
src/_image.cpp:891: error: expected `;' before 'height'
src/_image.cpp:894: error: 'PNG_COLOR_TYPE_GRAY' was not declared in this scope
src/_image.cpp:895: error: 'PNG_COLOR_TYPE_GRAY_ALPHA' was not declared in this scope
src/_image.cpp:896: error: 'png_set_gray_to_rgb' was not declared in this scope
src/_image.cpp:897: error: 'PNG_COLOR_TYPE_PALETTE' was not declared in this scope
src/_image.cpp:898: error: 'png_set_palette_to_rgb' was not declared in this scope
src/_image.cpp:902: error: 'png_set_strip_16' was not declared in this scope
src/_image.cpp:905: error: 'png_set_interlace_handling' was not declared in this scope
src/_image.cpp:906: error: 'png_read_update_info' was not declared in this scope
src/_image.cpp:908: error: 'PNG_COLOR_TYPE_RGBA' was not declared in this scope
src/_image.cpp:909: error: 'PNG_COLOR_TYPE_RGB' was not declared in this scope
src/_image.cpp:915: error: 'png_jmpbuf' was not declared in this scope
src/_image.cpp:918: error: 'png_bytep' was not declared in this scope
src/_image.cpp:918: error: 'row_pointers' was not declared in this scope
src/_image.cpp:918: error: expected type-specifier before 'png_bytep'
src/_image.cpp:918: error: expected `;' before 开发者_开发问答'png_bytep'
src/_image.cpp:919: error: expected `;' before 'row'
src/_image.cpp:921: error: 'row' was not declared in this scope
src/_image.cpp:921: error: 'height' was not declared in this scope
src/_image.cpp:922: error: expected type-specifier before 'png_byte'
src/_image.cpp:922: error: expected `;' before 'png_byte'
src/_image.cpp:924: error: 'png_read_image' was not declared in this scope
src/_image.cpp:929: error: 'height' was not declared in this scope
src/_image.cpp:930: error: 'width' was not declared in this scope
src/_image.cpp:936: error: expected `;' before 'y'
src/_image.cpp:936: error: 'y' was not declared in this scope
src/_image.cpp:938: error: expected `;' before 'x'
src/_image.cpp:938: error: 'x' was not declared in this scope
src/_image.cpp:940: error: 'ptr' was not declared in this scope
src/_image.cpp:951: error: 'png_read_end' was not declared in this scope
src/_image.cpp:952: error: 'png_infopp_NULL' was not declared in this scope
src/_image.cpp:952: error: 'png_destroy_read_struct' was not declared in this scope
src/_image.cpp:956: error: type '<type error>' argument given to 'delete', expected pointer
error: command 'gcc' failed with exit status 1


Those particular errors stem from the lack of the development package for libpng.

If you use Debian/Ubuntu, try apt-get install libpng-dev first.


if you are apt-based try

$ sudo apt-get build-dep matplotlib


You don't need to compile from source: sudo apt-get install python-matplotlib

The easy way out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜