在Windows 8.1上安装lxml,libxml2,libxslt [英] Installing lxml, libxml2, libxslt on Windows 8.1

查看:74
本文介绍了在Windows 8.1上安装lxml,libxml2,libxslt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现Linux发行版的现有Python文档非常出色.对于Windows ...不是很多.我已经很好地配置了Linux系统,但也需要一些帮助来准备Windows 8.1平板电脑.

I'm finding the existing Python documentation for Linux distributions excellent. For Windows... not so much. I've configured my Linux system fine but I need some help getting a Windows 8.1 tablet ready as well.

我的项目需要用于Python 3.4的lxml模块.我已经找到了许多有关如何安装lxml的教程,但是每个教程都失败了.

My project requires the lxml module for Python 3.4. I've found many tutorials on how to install lxml but each has failed.

https://docs.python.org/3/installing/ 我已经下载了"get-pip.py",并成功地从Windows cmd行中运行了它,结果是:

https://docs.python.org/3/installing/ I've downloaded the "get-pip.py" and successfully ran it from the Windows cmd line with the result:

Requirement already up-to-date: pip in c:\python34\lib\site-packages

因此,我认为我没有点子"问题.从那里,我从Windows cmd行运行以下命令:

So I don't think that I have a "pip" problem. From there I've run the following from the Windows cmd line:

python -m pip install lxml

一长串命令会滚动通过,但是有几行似乎是我无法解决的错误.

A long list of commands scroll through but there are a couple of lines that appear to be errors that I'm unable to resolve.

  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 **

Failed building wheel for lxml

最后一部分全是红色

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

在理解此方法的工作原理或我做错事情方面的任何帮助将不胜感激.

Any assistance in understanding how this should work, or what I'm doing wrong would be greatly appreciated.

推荐答案

我能够按照以下步骤修复安装.我希望其他人对此有所帮助.

I was able to fix the installation with the following steps. I hope others find this helpful.

在出现问题之前,我的"pip"安装工作正常.我转到Windows命令行,并确保已安装"wheel".

My installation of "pip" was working fine before the problem. I went to the Windows command line and made sure that "wheel" was installed.

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

之后,我从 http://www.lfd.uci.edu/~下载了lxml文件gohlke/pythonlibs/#lxml 并将其放在我的python目录"C:\ Python34"

After that I downloaded the lxml file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml and placed it in my python directory "C:\Python34"

在该目录中,我运行了以下内容:

In that directory I ran the following:

C:\Python34>python -m pip install lxml-3.4.4-cp34-none-win32.whl

结果是:

Processing c:\python34\lxml-3.4.4-cp34-none-win32.whl
Installing collected packages: lxml
Successfully installed lxml-3.4.4

我打开了PyCharm,并提供了lxml模块.我能够毫无问题地执行代码.

I opened PyCharm and lxml module was available. I was able to execute the code without problem.

我学到的东西(尽管其他一些知识渊博的人可以纠正)

What I learned (though this may be corrected by others more knowledgeable)

  1. 需要使用pip和wheel安装所需的模块(作为"* .whl"文件).
  2. 使用Dropbox与不同的PyCharm安装共享代码文件夹会引起"workspace.xml"文件的混乱.两台计算机继续互相写,弄乱了安装路径.

希望这会有所帮助.

这篇关于在Windows 8.1上安装lxml,libxml2,libxslt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆