python - 将 lxml 安装到 virtualenv

标签 python windows virtualenv lxml

我正在尝试在 Windows 7 上使用 Python3.4 在 vi​​rtualenv 中安装最新的 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/

相关文章:

Python:运行时根据requirements.txt设置PYTHONPATH

Python - 列表中的最佳匹配

Windows cmd 将一个命令的输出作为参数传递给另一个命令

python - string.upper(<str>) 和 <str>.upper() 不会执行

windows - 为什么此 QString 到 const char* 的转换会在 Windows 上生成 Debian 标识符?

c++ - 如何从 C 或 C++ 修改 Windows 操作系统的注册表

python - 可以让 virtualenvs 回退到用户包而不是系统包吗?

python - 检索 virtualenv 中 Python 库的外部 C/Fortran 依赖项列表

python - 我怎样才能 'clean up' 一个 virtualenv?

python - sqlalchemy:如何为方言自定义标准类型(例如 DateTime() 参数绑定(bind)处理)?