简体   繁体   English

无法在 Windows 上安装 lxml,致命错误 C1083:无法打开包含文件:'libxml/xmlversion.h'

[英]Cannot install lxml on windows, fatal error C1083: Cannot open include file: 'libxml/xmlversion.h'

Python noob, please bear with me. Python菜鸟,请多多包涵。 I used python installer for v3.5.1 from www.python.org.我使用来自 www.python.org 的 v3.5.1 的 python 安装程序。 My intent was to use Scrapy to run some scripts.我的意图是使用 Scrapy 来运行一些脚本。

pip install scrapy failed, as did easy_install scrapy and others. pip install scrapy 失败,easy_install scrapy 和其他人也是如此。 I traced the error to a faulty install of lxml.我将错误追溯到 lxml 的错误安装。 Here is the error log.这是错误日志。 I've even tried easy_installing libxml2, I'm not sure how to proceed.我什至尝试过easy_installing libxml2,我不知道如何继续。

Building lxml version 3.5.0.
Building without Cython.
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
cl : Command line warning D9025 : overriding '/W3' with '/w'
lxml.etree.c
src\lxml\includes\etree_defs.h(14): fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory
Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
xmlXPathInitck3f6zpk.c
C:\Users\Rohan\AppData\Local\Temp\easy_install-47utdost\lxml-3.5.0\temp\xmlXPathInitck3f6zpk.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
*********************************************************************************
error: Setup script exited with error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

I had the same problem, albeit using WinPython 64bit 2.7.3.1.我遇到了同样的问题,尽管使用的是 WinPython 64bit 2.7.3.1。

I solved it using the precompiled installer which can be found here: https://pypi.python.org/pypi/lxml/3.3.3#downloads我使用预编译的安装程序解决了它,可以在这里找到: https ://pypi.python.org/pypi/lxml/3.3.3#downloads

Directly installing the package by running the .exe failed, because the installer could not find my python installation (altough it is registered).通过运行 .exe 直接安装包失败,因为安装程序找不到我的 python 安装(尽管它已注册)。 However, I then successfully used the WinPython Control Panel to install the package!但是,我随后成功使用 WinPython 控制面板安装了该软件包!

edit: before that, I tried various things which I found on stackoverflow, including installing some Visual C++ (Python) compilers but none of that worked.编辑:在此之前,我尝试了在 stackoverflow 上找到的各种东西,包括安装一些 Visual C++ (Python) 编译器,但都没有奏效。

I had the same problem using Python 64bit 2.7.11 on Windows 10.我在 Windows 10 上使用 Python 64bit 2.7.11 时遇到了同样的问题。

After I tried installing scrapy using pip many times, I had success as follow:在我多次尝试使用pip安装 scrapy 后,我取得了如下成功:

  1. First I installed precompiled package lxml v3.6.0 from .exe file.首先,我从.exe文件安装了预编译包lxml v3.6.0 It can be found here https://pypi.python.org/pypi/lxml/3.6.0 .它可以在这里找到https://pypi.python.org/pypi/lxml/3.6.0

  2. Finally, I ran pip install scrapy again and installation ended successful.最后,我再次运行pip install scrapy并安装成功。

Happy hacking !!!快乐黑客!

I couldn't use PYPY to install the package normally however I could use normal pip.我无法使用 PYPY 正常安装软件包,但是我可以使用普通的 pip。 So I went to my file system and took the lxml files from python39>lib and copy pasted them into my pypy>lib file.所以我去了我的文件系统并从 python39>lib 中取出 lxml 文件并将它们复制粘贴到我的 pypy>lib 文件中。 The files are: lxml lxml-4.8.0.dist-info这些文件是: lxml lxml-4.8.0.dist-info

暂无
暂无

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

相关问题 Could not install pycocotools in windows: fatal error C1083: Cannot open include file: 'io.h': No such file or directory 错误: - Could not install pycocotools in windows: fatal error C1083: Cannot open include file: 'io.h': No such file or directory error: 无法安装 pyodbc,缺少 header 个文件,命令提示符:致命错误 C1083:无法打开包含文件:'windows.h':没有这样的文件或目录 - Cannot install pyodbc, missing header files, command prompt: fatal error C1083: Cannot open include file: 'windows.h': No such file or directory Python pip install kivy致命错误C1083:无法打开包含文件:'GL / glew.h':没有这样的文件或目录 - Python pip install kivy fatal error C1083: Cannot open include file: 'GL/glew.h': No such file or directory SWIG致命错误C1083:无法打开包含文件 - SWIG Fatal error C1083: Cannot open include file 在 Windows x64 中运行 Cython - 致命错误 C1083:无法打开包含文件:'basetsd.h':没有这样的文件或目录 - Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory 无法安装mysql客户端1.3.12出现致命错误C1083:无法打开包含文件:mysql.h:无此类文件或目录 - Unable to install mysql client 1.3.12 getting fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory 无法安装 matplotlib:致命错误 C1083:无法打开包含文件:'ft2build.h':没有这样的文件或目录 - Can't install matplotlib : fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory 致命错误 C1083:无法打开包含文件:“mecab.h”:没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'mecab.h': No such file or directory 致命错误 C1083:无法打开包含文件:'io.h':没有这样的文件或目录 - fatal error C1083: Cannot open include file: 'io.h': No such file or directory 使用 python 3.6.4 在 Windows 10 上安装 Gdal:致命错误 C1083:无法打开包含文件:'cpl_port.h' - installing Gdal on Windows 10 with python 3.6.4: fatal error C1083: Cannot open include file: 'cpl_port.h'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM