简体   繁体   English

如何使用Python 2.7安装aggdraw

[英]How to install aggdraw with Python 2.7

I'd like to use aggdraw with Python 2.7. 我想在Python 2.7中使用aggdraw。 (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. (无论如何,这是一个愚蠢的主意吗?我已经看到了一个不错的aggdraw示例,但我不想回归到Python 2.6。是否有与Python 2.7等效的图形库?)我安装了Python 2.7.8 64bit Windows 7 Enterprise SP 1 64位。

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 . 位于http://www.effbot.org/downloads#aggdraw的安装程序抱怨缺少Python 2.6,而python setup.py install抱怨缺少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 . 因此,在这里所有相关文章之后,我从http://www.microsoft.com/zh-cn/download/details.aspx?id=44266安装了MS编译器。 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. 它在“程序和功能”列表中可见,并且我现在在C:\\Users\\d031475\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0有一个vcvarsall.bat

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. 不过, python setup.py install既不能直接在CMD中运行,也不能在我的“开始”菜单中显示的MS Visual... Compiler for Python 2.7命令提示符下运行。 It still complains about a missing vcvarsall.bat . 它仍然抱怨缺少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. 编辑:即使我将相关目录附加到我的路径中,以便可以从命令行运行vcvarsall.batpython setup.py install仍然抱怨找不到它。 How strange is that? 那有多奇怪?

To build with "Microsoft Visual C++ Compiler for Python 2.7" you need to use setuptools >= 6.0 instead of distutils. 要使用“适用于Python 2.7的Microsoft Visual C ++编译器”进行构建,您需要使用setuptools> = 6.0而不是distutils。 Try to change the line from distutils.core import setup, Extension in setup.py to from setuptools import setup, Extension . 尝试将行from distutils.core import setup, Extension setup.py from distutils.core import setup, Extension更改from setuptools import setup, Extension

You'll need to build against the freetype library to enable text rendering. 您需要针对freetype库进行构建以启用文本呈现。

The aggdraw project appears to be abandoned. aggdraw项目似乎已被放弃。 The latest version 1.2a3 is from early 2006 and predates Python 2.7, 64 bit, and Pillow. 最新版本1.2a3始于 2006年初,早于Python 2.7、64位和Pillow。 Expect crashes, especially on 64 bit for Windows. 可能会崩溃,尤其是在Windows的64位上。

Unofficial Windows binaries for aggdraw are available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#misc . 可从http://www.lfd.uci.edu/~gohlke/pythonlibs/#misc获得用于aggdraw的非官方Windows二进制文件。

An alternative to aggdraw is pycairo ( Windows binaries ). aggdraw的替代方法是pycairoWindows二进制文件 )。

Do not try to mess around with the Compiler things yourself. 不要试图自己弄乱Compiler的东西。

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/ 到目前为止,最简单且经过测试的解决方案是从以下位置将适合您的Windows Binaries下载到适合您的环境的Windows Binaries: 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. 将其放入cmd后,转到下载文件夹并使用pip进行安装(使用刚刚下载的whl脚本的文件名。

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

DONE! 完成!

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

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