我正在尝试在 Windows 7 上使用 Python3.4 在 virtualenv 中安装最新的 lxml 模块。作为 Linux 的长期用户,这个过程应该很简单,但当然不是。我正在尝试安装最新的 lxml,目前没有适用于 Python3.4+ 的软件包因此,我获得了 libxml2 和 libxslt,但似乎无法识别它们。谁能指出我将所有内容链接在一起的正确方向。
我已经厌倦了 http://lxml.de/build.html 中的几乎所有内容以及我能想到的所有变体。任何帮助将不胜感激。
错误日志如下:
Building lxml version 3.4.1.
Building with Cython 0.21.1.
ERROR: b"'xslt-config' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
** make sure the development packages of libxml2 and libxslt are installed **
Using build configuration of libxslt
missing cimport in module 'lxml.includes': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.includes.tree': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.python': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml': src\lxml\lxml.etree.pyx
missing cimport in module 'lxml.includes': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml.includes.etreepublic': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml.includes.tree': src\lxml\lxml.objectify.pyx
missing cimport in module 'lxml': src\lxml\lxml.objectify.pyx
C:\Python34\Lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
running build
running build_py
copying src\lxml\includes\lxml-version.h -> build\lib.win32-3.4\lxml\includes
running build_ext
building 'lxml.etree' extension
C:\minGW\bin\gcc.exe -mdll -O -Wall -IC:\Users\username\Desktop\angelScripts\draft\lxml-master\src\lxml\includes -IC:\Pyth
on34\include -IC:\Python34\include -c src\lxml\lxml.etree.c -o build\temp.win32-3.4\Release\src\lxml\lxml.etree.o -w
In file included from src\lxml\lxml.etree.c:239:0:
C:\Users\username\Desktop\angelScripts\draft\lxml-master\src\lxml\includes/etree_defs.h:14:31: fatal error: libxml/xmlvers
ion.h: No such file or directory
#include "libxml/xmlversion.h"
^
compilation terminated.
error: command 'C:\\minGW\\bin\\gcc.exe' failed with exit status 1
最佳答案
我从 Christoph's Gohlke's Python page 下载了 lxml-3.4.4-cp34-none-win_amd64.whl并使用
安装它pip install lxml-3.4.4-cp34-none-win_amd64.whl
它对我有用。
关于python - 将 lxml 安装到 virtualenv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27363697/