在 windows 上安装 python3 + lxml

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7910705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:21:52  来源:igfitidea点击:

install python3 + lxml on windows

pythonwindowswindows-7python-3.xlxml

提问by pguardiario

I would like to install python3 with lxml on windows 7. There seems to be several versions available. What's the best version/way to install?

我想在 Windows 7 上使用 lxml 安装 python3。似乎有几个版本可用。最好的版本/安装方式是什么?

  • By best I mostly mean the easiest.
  • Points if I don't have to compile anything.
  • 最好的我主要是指最简单的。
  • 如果我不需要编译任何东西,就加分。

采纳答案by bakennedy

Use the current stable version of 3, 3.2.2. You can find a windows installer here http://python.org/ftp/python/3.2.2/python-3.2.2.msithat will install python for you.

使用当前的稳定版本 3、3.2.2。你可以在这里找到一个 Windows 安装程序http://python.org/ftp/python/3.2.2/python-3.2.2.msi它将为你安装 python。

Use the Python Package Index version of lxml: it has a windows installer specifically for Python 3.

使用 lxml 的 Python Package Index 版本:它有一个专门用于 Python 3 的 Windows 安装程序。

http://pypi.python.org/packages/3.1/l/lxml/lxml-2.2.8.win32-py3.1.exe#md5=d1fb73a8596bb77e155cef7ae6b0bc53

http://pypi.python.org/packages/3.1/l/lxml/lxml-2.2.8.win32-py3.1.exe#md5=d1fb73a8596bb77e155cef7ae6b0bc53

Download and run the Python installer then download and run the lxml installer: it should be that easy.

下载并运行 Python 安装程序,然后下载并运行 lxml 安装程序:就这么简单。

回答by Deina Underhill

I had the same problem locating the correct version. After several hours of confusion I finally found the windows binary for Python 3 at Christoph Gohlke's Unofficial Windows Binaries for Python Extension Packageswebsite at UC, Irvine.

我在定位正确版本时遇到了同样的问题。经过几个小时的困惑,我终于在 Christoph Gohlke位于欧文加州大学的Python 扩展包非官方 Windows 二进制文件网站上找到了 Python 3 的Windows 二进制文件

He truly has the A-Z of Python extensions, as long as it's available for Python. Anything one could want from the PIP installer to Chinese word segmentation, to a multi-taper Fourier spectral estimator. Beyond that it gets into biologic & scientific specialty extensions.

他确实拥有 Python 扩展的 AZ,只要它可用于 Python。从 PIP 安装程序到中文分词,再到多锥傅立叶谱估计器,任何人都想要。除此之外,它进入生物和科学专业扩展。

回答by Flak DiNenno

No compilations and IMHO, the best way:

没有汇编和恕我直言,最好的方法:

Mainly because the instructions below the most complete andstill FAST to complete. On more than one occasions, using just the MSI and the LXML binaries, I've run into issues with the install breaking/getting gccand mingwerrors.

主要是因为下面的说明最完整,而且还是 FAST 完成。在不止一次的情况下,仅使用 MSI 和 LXML 二进制文件,我遇到了安装中断/获取gccmingw错误的问题。



These instructions are for Windows7 or Windows8 with Python3.3.

这些说明适用于带有 Python3.3 的 Windows7 或 Windows8

However, they should work for various versions as the releases of python and other respective prerequisites change/evolve:

但是,它们应该适用于各种版本,因为 python 的版本和其他相应的先决条件发生了变化/发展:

  1. Install Python3.3:
    1. Download the last release of Python3.3 (currently 3.3.5) from the downloads page HERE
      • Direct link for Win32 MSI installer -> HERE
      • Direct link for Win64 MSI installer -> HERE
    2. Simply run the MSI to install python. It will register itself in the registry, and appear in Add/REmove Programs.
    3. NOTE:my instructions that follow assume that you choose to install python to the default path of C:\python33\when asked during the Python Installation Wizard
  2. Add the C:\python33\and C:\python33\scriptsfolders to the system path by adding those directories to the PATHenvironment variable from the Control Panel > System > Advanced System Settings link (Advanced Tab) > Environmental Variables (Button).
  3. (OPTIONAL) Install OpenSSL:
    1. Download Win32 OpenSSL pagefrom HEREfor your version of Windows and PC architecture
    2. Download Visual C++ 2008 redistributablesfor your version of Windows and PC architecture
    3. Download OpenSSLfor your version of Windows and architecture (the regular version, not the light one)
    4. Add the following (depending on your architecture) directory (or wherever you insalled to) to your PATH, the same way you added C:\python33and C:\python33\scriptsabove:
      • 32-bit:c:\openssl-win32\bin
      • 64-bit:c:\openssl-win64\bin
  4. Install Setuptools(get-pip.pyshould install Setuptools for you), but, just in case...
    1. Download ez_setup.pyHEREand save it in C:\python33\scripts
    2. Run C:\python33\scripts> python ez_setup.py
  5. Install PIP
    1. Download get-pip.pyfrom HEREand save it in C:\python33\scripts
    2. Run C:\python33\scripts> python get-pip.py
  6. Install LXML
    1. Download LXML 3.3.3from HEREfor your version of Windows and PC architecture
    2. Run the EXE file
  1. 安装Python3.3
    1. 此处的下载页面下载 Python3.3 的最新版本(当前为 3.3.5)
      • Win32 MSI 安装程序的直接链接 ->此处
      • Win64 MSI 安装程序的直接链接 ->这里
    2. 只需运行 MSI 即可安装 python。它将在注册表中注册自己,并出现在添加/删除程序中。
    3. 注意:我接下来的说明假设您选择将 python 安装到C:\python33\Python 安装向导期间询问的默认路径
  2. 通过从“控制面板”>“系统”>“高级系统设置”链接(“高级”选项卡)>“环境变量”(按钮)将这些目录添加到环境变量中,将C:\python33\C:\python33\scripts文件夹添加到系统路径中。PATH
  3. (可选)安装OpenSSL
    1. 此处下载适用于您的 Windows 和 PC 架构版本的 Win32 OpenSSL 页面
    2. 下载适用于您的 Windows 和 PC 架构版本的Visual C++ 2008 可再发行组件
    3. 下载适用于您的 Windows 版本和体系结构的OpenSSL(常规版本,而不是轻量版本)
    4. 添加以下(取决于你的体系结构)的目录(或你insalled到)你的PATH,同样的道理,你添加C:\python33C:\python33\scripts上面:
      • 32 位:c:\openssl-win32\bin
      • 64 位:c:\openssl-win64\bin
  4. 安装Setuptoolsget-pip.py应该为您安装 Setuptools),但是,以防万一...
    1. ez_setup.py此处下载并将其保存在C:\python33\scripts
    2. C:\python33\scripts> python ez_setup.py
  5. 安装画中画
    1. get-pip.py这里下载并保存在C:\python33\scripts
    2. C:\python33\scripts> python get-pip.py
  6. 安装LXML
    1. LXML 3.3.3这里下载适用于您的 Windows 和 PC 架构版本
    2. 运行EXE文件

回答by Kanguros

The latest version of lxml (3.6.0) now supports the Wheel format, so there is no problem with installing it with pip:

最新版的lxml(3.6.0)现在支持Wheel格式,所以用pip安装是没有问题的:

pip install lxml