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

查看:20
本文介绍了在 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:python34libsite-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,
operable program or batch file.
"
  ** make sure the development packages of libxml2 and libxslt are installed **

Failed building wheel for lxml

最后一部分,全部为红色

And the last part, all in red

Command "C:Python34python.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('
', '
'), __file__, 'exec'))" install --record C:UsersOwnerAppDataLocalTemppip-ytybzl9l-r
ecordinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersOwnerAppDataLocalTemppip-build-ya3n6wkdlxml

在理解这应该如何工作或我做错了什么方面的任何帮助将不胜感激.

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:python34libsite-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:python34lxml-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天全站免登陆