简体   繁体   English

如何在此错误后安装aggdraw?

[英]How can I install aggdraw after this error?

I am trying to install the aggdraw python library to create high quality graphics but I keep getting this error: 我正在尝试安装aggdraw python库来创建高质量的图形,但我不断收到此错误:

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

What is the workaround for this? 这是什么解决方法? How can I install it? 我该如何安装?

You should follow the instructions in http://www.pocketuniverse.ca/archive/2008/december/11/pil-and-aggdraw/ to patch AGG rather than just have the compiler allow the 64-bit incompatible code to compile. 您应该按照http://www.pocketuniverse.ca/archive/2008/december/11/pil-and-aggdraw/中的说明修补AGG,而不是让编译器允许编译64位不兼容的代码。

Here's one way you could do it in the shell: 以下是在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

(Yes I am answering my own question) (是的,我正在回答我自己的问题)

After searching a lot through the web I found that doing 经过网络搜索后我发现了

export CFLAGS="-fpermissive"   

before building the extension with python setup.py build_ext -i seemed to do the trick. 在使用python setup.py build_ext -i构建扩展之前, python setup.py build_ext -i似乎可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM