Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install aggdraw with Python 2.7

I'd like to use aggdraw with Python 2.7. (Is this a dumb idea anyway? I've seen a nice aggdraw example, but I don't want to regress to Python 2.6. Is there an equivalent drawing library working with Python 2.7?) I have Python 2.7.8 64bit installed on a Windows 7 Enterprise SP 1 64bit.

The installer at http://www.effbot.org/downloads#aggdraw complains about Python 2.6 missing, and python setup.py install complains about a missing vcvarsall.bat.

So, following all the related posts here, I installed the MS compiler from http://www.microsoft.com/en-us/download/details.aspx?id=44266. It's visible in the "Programs and Features" list, and I have a vcvarsall.bat in C:\Users\d031475\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0 now.

Still, python setup.py install neither runs in CMD directly, nor in the MS Visual... Compiler for Python 2.7 command prompt which appeared in my Start menu. It still complains about a missing vcvarsall.bat.

EDIT: Even when I append the relevant directory to my path, so that I can run vcvarsall.bat from the command line, python setup.py install still complains it can't find it. How strange is that?

like image 722
virtualnobi Avatar asked Nov 21 '14 19:11

virtualnobi


2 Answers

To build with "Microsoft Visual C++ Compiler for Python 2.7" you need to use setuptools >= 6.0 instead of distutils. Try to change the line from distutils.core import setup, Extension in setup.py to from setuptools import setup, Extension.

You'll need to build against the freetype library to enable text rendering.

The aggdraw project appears to be abandoned. The latest version 1.2a3 is from early 2006 and predates Python 2.7, 64 bit, and Pillow. Expect crashes, especially on 64 bit for Windows.

Unofficial Windows binaries for aggdraw are available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#misc.

An alternative to aggdraw is pycairo (Windows binaries).

like image 62
cgohlke Avatar answered Nov 16 '22 02:11

cgohlke


Do not try to mess around with the Compiler things yourself.

The by far easiest and tested solution is to download the to your environment fitting Windows Binaries for aggdraw from here: http://www.lfd.uci.edu/~gohlke/pythonlibs/

Once you have it go in cmd to your download folder and install with pip (use filename of just downloaded whl script.

pip install aggdraw-1.2a3-cp27-none-win32.whl

DONE!

like image 2
Philipp Schwarz Avatar answered Nov 16 '22 01:11

Philipp Schwarz