无法导入Imagick程序包

I am trying to install the Imagick package for Go. I run the command:

go get gopkg.in/gographics/imagick.v3/imagick

As per the documentation but I always get this error:

# gopkg.in/gographics/imagick.v3/imagick
src/gopkg.in/gographics/imagick.v3/imagick/affine_matrix.go:8:35: fatal error: MagickWand/MagickWand.h: No such file or directory
 #include <MagickWand/MagickWand.h>
                                   ^
compilation terminated.

I've looked online but have yet to find a solution that works. I have tried using apt-get libmagickwand-dev and that did not resolve the issue. I am currently running Ubuntu 14.04 LTS.

Also as per the documentation, imagick.v3 supports ImageMagick version 7 and up. You have ImageMagick version 6.7.7-10. This is too old for imagick v3, and also too old for imagick v2, but v1 may work.

I had the same error on Mac OS High Sierra. First, you need to install ImageMagick and then specify the library path.

  1. Install ImageMagick: (I used Homebrew)

    brew install imagemagick
    
  2. Set the PKG_CONFIG_PATH environment variable if ImageMagick is not in your default system path:

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    

    from here

  3. Go get the package:

    go get -u gopkg.in/gographics/imagick.v3/imagick
    

To find out more about pkg-config, just type man pkg-config