当前位置: 首页 > 工具软件 > PythonMagick > 使用案例 >

python wand安装_安装PythonMagick和pythonmagickwand 步骤

都昊乾
2023-12-01

在centos6.0上测试安装,安装前准备工作:

###############################################################################

服务器如果没有安装Jpeg v6b、libPng、FreeType 的要在安装imagemagick之前先装好,否则imagemagick没法读取jpeg和png图片,字体文

件也读不了.

python的版本须>=2.6

需要升级python, 能在/usr/include/pythonX/下找到python.h文件

yum install python-devel -y

yum install ImageMagick* -y

yum install ImageMagick-devel ImageMagick-c++ ImageMagick-c++-devel -y  ****校验一下 解决找不到MagickCore问题

查看ImageMagick的版本号

convert -version

安装或升级boost

yum install boost*

yum install boost-python ##校验boost-python是否安装

###############################################################################

安装PythonMagick

PythonMagick的下载地址

wget http://www.imagemagick.org/download/python/legacy/PythonMagick-0.9.3.tar.gz

wget http://www.imagemagick.org/download/python/PythonMagick-0.9.7.tar.gz

tar zxvf PythonMagick-0.9.7.tar.gz

tar zxvf PythonMagick-0.9.3.tar.gz

cd PythonMagick-0.9.7

./autogen.pl

mkdir /usr/local/python

./configure  #2012.2.12进行到此步了

make  ##时间漫长,耐心等待...

出现一些的问题:

_Image.cpp  -fPIC -DPIC -o .libs/libpymagick_la-_Image.o

_Image.cpp: In function ‘void Export_pyste_src_Image()’:

_Image.cpp:89: error: address of overloaded function with no contextual type information

_Image.cpp:90: error: address of overloaded function with no contextual type information

_Image.cpp:97: error: address of overloaded function with no contextual type information

_Image.cpp:114: error: address of overloaded function with no contextual type information

.............

make出错了就make clean

然后

解决办法:

从PythonMagick-0.9.3/pythonmagick_src/将以下文件cp到PythonMagick-0.9.7/pythonmagick_src/下覆盖原有的

_Image.cpp

_DrawableDashArray.cpp

_DrawableMiterLimit.cpp

_DrawableViewbox.cpp

_Geometry.cpp

参考:http://www.geero.net/2011/03/install-pythonmagick-mac-os-x.html

./autogen.pl

./configure

make ##时间漫长,耐心等待...

在libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../config -I/usr/include/python2.6 -I/usr/include -fopenmp -

I/usr/include/ImageMagick -g -O2 -DBOOST_PYTHON_DYNAMIC_LIB -MT libpymagick_la-_Image.lo -MD -MP -MF .deps/libpymagick_la-

_Image.Tpo -c _Image.cpp  -fPIC -DPIC -o .libs/libpymagick_la-_Image.o

的时候慢点让人无法忍受...干...

make install

成功安装后的正确提示:

Libraries have been installed in:

/usr/local/lib64/python2.6/site-packages/PythonMagick

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,-rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

重要一步:

cp -rp  /usr/local/lib64/python2.6/site-packages/PythonMagick/ /usr/lib64/python2.6/site-packages/PythonMagick/

验证是否已经安装上了PythonMagick

[root@localhost ~]# python

Python 2.6.6 (r266:84292, Dec  7 2011, 20:48:22)

[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import PythonMagick

>>>

import无错误返回 表示模块 PythonMagick安装成功

也可以

[root@localhost ~]# pydoc -p2008

pydoc server ready at http://localhost:2008/

从浏览器看看支持的模块

################################################################################

################################################################################

 类似资料: