PythonMagick是ImageMagick的python开发包。
下载:
PythonMagick-0.7.tar.gz
安装之前确认是否安装了下列库或包:
boost
boost-python
python 2.5
Magick++ (>= 6.2)
还要确认是否安装了下列工具:
pkg-config
libtool
make
然后执行下列命令进行安装:
$ tar -xzf PythonMagick-0.7.tar.gz
$ cd PythonMagick-0.7
$ ./configure
$ make
$ make install
make install的时候,必须具备root权限,看起来似乎很顺利,标准的安装过程,但是实际上一开始就出问题了
问题一: ./configure的时候找不到ImageMagick,实际上我是安装了的,关于ImageMagick的安装请参看我的博文:
[tips]ImageMagick软件包简介及安装,这个时候进入当前登录用户的home目录,打开.bash_profile文件,加入以下几行:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
其中/usr/local/lib/pkgconfig为ImageMagick的包描述文件所在目录
保存并退出到命令行后,执行下列命令使之生效:
$ source .bash_profile
做完上述配置后,./configure是没有问题了。
问题二: make的时候会报 no matching function for call to 'registry_lookup(const volatile void (*)())' 的错误,这个问题比较麻烦,在google上找了很久,说是boost-python不再支持void*的原因,经过自己的一些尝试,才找到解决办法:
1 首先把下列提及文件中的void* or void * 全部替换为unsigned char* or unsigned char *,注意在替换的时候,要符合c++的语法:
PythonMagick-0.7/pythonmagick_src/_Blob.cpp _Image.cpp
/usr/local/include/Magick++/Blob.h Image.h
其中/usr/local/include/Magick++为ImageMagick安装后的头文件,可能会有所不同;
2 进入PythonMagick-0.7/pyste_src,找到Blob.pyste、Image.pyste,更改文件中的路径为正群的安装路径;
3 进入PythonMagick-0.7/helpers_src,找到Blob.cpp,打开,将其内容替换为:
cpp 代码
- #include "Blob.h"
-
- void update_wrapper(Magick::Blob& blob, const std::string& data) {
- blob.update((unsigned char*)(const_cast<char*>(data.c_str())),data.size());
- }
-
- std::string get_blob_data(const Magick::Blob& blob) {
- const unsigned char* data = static_cast<const unsigned char*>(blob.data());
- size_t length = blob.length();
- return std::string(data,data+length);
- }
做完以上设置后,按照安装步骤走,就搞定了,如果编译过程中出现问题,就再仔细检查1中所提到的文件中的void *指针是否替换完,因为有几个地方,void和*之间会有很多空格,要注意检查。
分享到:
- 2007-12-06 22:23
- 浏览 8941
- 评论(0)
- 论坛回复 / 浏览 (0 / 3468)
- 查看更多
相关推荐
abap tips abap tips abap tips abap tips abap tips
android TIPS小结android TIPS小结android TIPS小结android TIPS小结
jquery,tips,冒泡,jquery,tips,冒泡
swifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-tips.pdfswifter-...
jquery tips提示图片信息
10 Tips to Help You Achieve Your Software Testing Documentation Goal 10 Tips to Help You Achieve Your Software Testing Documentation Goal
* $(selector).tips({ //selector 为jquery选择器 * msg:'your messages!', //你的提示消息 必填 * side:1, //提示窗显示位置 1,2,3,4 分别代表 上右下左 默认为1(上) 可选 * color:'#FFF', //提示文字色 默认...
源码参考,欢迎下载
100 power tips for fpga designers
Quickly access 50 tips for software test engineers using automated methods. The tips point to practices that save time and increase the accuracy and reliability of automated test techniques. ...
【JS提示语tips】tips.class.demo
wxPython Grid Tips and Tricks
纹理图像分类数据集,KTH-TIPS数据集,包含orange-peel、bread等10类纹理图像
Onevcat Swifter - Swift 开发者必备 Tips
Microsoft visual studio tips pdf
Android-Tips This is an awesome list of tips for android. If you are a beginner, this list will be the first choice for you when you have a difficult time. Welcome Star and Fork, your support is my ...
KTH-TIPS 纹理材质数据.zip
利用Python进行数据分析,小费数据集。
1. 可以用来作为学习swing的辅助工具 ...3. 使用方式 java -jar swing-tips-helper.jar ,如果你需要源码及资源及更多详细介绍参考该地址 https://blog.csdn.net/x308561498/article/details/123211860
Oracle Database 12c Release 2 Performance Tuning Tips and Techniques