簡體   English   中英

無法在 Windows 上安裝 lxml,致命錯誤 C1083:無法打開包含文件:'libxml/xmlversion.h'

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

Python菜鳥,請多多包涵。 我使用來自 www.python.org 的 v3.5.1 的 python 安裝程序。 我的意圖是使用 Scrapy 來運行一些腳本。

pip install scrapy 失敗,easy_install scrapy 和其他人也是如此。 我將錯誤追溯到 lxml 的錯誤安裝。 這是錯誤日志。 我什至嘗試過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

我遇到了同樣的問題,盡管使用的是 WinPython 64bit 2.7.3.1。

我使用預編譯的安裝程序解決了它,可以在這里找到: https ://pypi.python.org/pypi/lxml/3.3.3#downloads

通過運行 .exe 直接安裝包失敗,因為安裝程序找不到我的 python 安裝(盡管它已注冊)。 但是,我隨后成功使用 WinPython 控制面板安裝了該軟件包!

編輯:在此之前,我嘗試了在 stackoverflow 上找到的各種東西,包括安裝一些 Visual C++ (Python) 編譯器,但都沒有奏效。

我在 Windows 10 上使用 Python 64bit 2.7.11 時遇到了同樣的問題。

在我多次嘗試使用pip安裝 scrapy 后,我取得了如下成功:

  1. 首先,我從.exe文件安裝了預編譯包lxml v3.6.0 它可以在這里找到https://pypi.python.org/pypi/lxml/3.6.0

  2. 最后,我再次運行pip install scrapy並安裝成功。

快樂黑客!

我無法使用 PYPY 正常安裝軟件包,但是我可以使用普通的 pip。 所以我去了我的文件系統並從 python39>lib 中取出 lxml 文件並將它們復制粘貼到我的 pypy>lib 文件中。 這些文件是: lxml lxml-4.8.0.dist-info

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM