在为Python3.5.1安装lxml时遇到问题

时间:2016-06-09 12:50:36

标签: python python-3.x

有一段时间我现在一直在试图弄清楚如何安装lxml但没有这样的运气。作为最后的希望之沟。我来这里寻求解决方案或澄清。到目前为止,我已经在其他答案线程中尝试了几乎所有的方式,但没有运气。

首先,我尝试了以下方法:

 pip install lxml 

 pip3 install lxml

python -m pip install lxml

引发了错误......

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 **
C:\Users\Me\AppData\Local\Temp\xmlXPathInit1owazwq3.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: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for lxml

然后我继续尝试安装轮子......

python -m pip install wheel 

C:\Users\Me>python -m pip install wheel
Requirement already satisfied (use --upgrade to upgrade): wheel in c:\python35\lib\site-packages

这似乎有效。

然而,当我试图再次安装lxml时......

Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?

    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

    Command "c:\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Me\\AppData\\Local\\Temp\\pip-build-klrlh4_w\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\Me\AppData\Local\Temp\pip-k3saekal-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Me\AppData\Local\Temp\pip-build-klrlh4_w\lxml\

然后我尝试下载.whl文件..

python -m pip install lxml-3.6.0-cp35-cp35m-win_amd64.whl

^下载了几乎所有这些.whl文件
只是为了得出相同的结论

lxml-3.6.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform. 

遗憾的是,这些都没有能够安装lxml ...

lxml能否在python3.5.1上运行?

任何帮助都会有所帮助:)

1 个答案:

答案 0 :(得分:1)

检查您需要下载的版本...

import sys

is_64bits = sys.maxsize > 2**32

print(is_64bits )

然后下载正确版本的lxml .. http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

所有功劳归于@Manjabes - https://stackoverflow.com/users/396571/manjabes

感谢您的帮助< 3