我正试图安装aggdraw python库来创建高质量的图形,但我始终收到以下错误:

agg22/include/agg_array.h: In member function `agg::int8u*

解决办法是什么如何安装?

最佳答案

您应该按照http://www.pocketuniverse.ca/archive/2008/december/11/pil-and-aggdraw/中的说明来修补agg,而不是让编译器只允许编译64位不兼容的代码。
有一种方法可以在shell中实现:

cd /tmp
svn co http://svn.effbot.org/public/tags/aggdraw-1.2a3-20060212
cd aggdraw-1.2a3-20060212
patch -p0 <<EOF
Index: agg2/include/agg_array.h
===================================================================
--- agg2/include/agg_array.h    (revision 532)
+++ agg2/include/agg_array.h    (working copy)
@@ -520,7 +520,7 @@
                 int8u* ptr = m_buf_ptr;
                 if(alignment > 1)
                 {
-                    unsigned align = (alignment - unsigned(ptr) % alignment) % alignment;
+                    unsigned align = (alignment - (unsigned long)(ptr) % alignment) % alignment;
                     size += align;
                     ptr += align;
                     if(size <= m_rest)
EOF

python setup.py build_ext -i
python selftest.py
sudo python setup.py install

10-06 06:17