How to install lxml in Python 3.4 on Windows machine

前端 未结 1 1559
时光取名叫无心
时光取名叫无心 2021-01-03 13:57

I\'ve been spending hours on this. I\'m new to Python and can\'t see what the solution may be.

I have Python 3.4 and want to work with .docx, which requires

相关标签:
1条回答
  • 2021-01-03 14:59

    As said at the lxml homepage, it happened to you:

    If you fail to build lxml on your MS Windows system from the signed and tested sources that we release, consider using the binary builds from PyPI or the unofficial Windows binaries that Christoph Gohlke generously provides.

    So you have to download the right wheel file from Unofficial Windows Binaries for Python Extension Packages.

    Step 1: Download appropriate version

    Depending on your machine you have to download the wheel file lxml‑3.4.4‑cp34‑none‑win32.whl or lxml‑3.4.4‑cp34‑none‑win_amd64.whl, because you want the version for Python3.4 (that's the 34 in cp34).

    Step 2: Open cmd and navigate to the download folder

    I have chosen to open the cmd in administrator mode. But this is probably not necessary for you.

    Step 3: Install wheel file with pip

    Now you have to install the unofficial wheel file with pip. Maybe you can do pip install pip --upgrade before you install the wheel file. But this is probably also not necessary for you. To do the installation, just type pip install <downloaded_file>.

    Or as cgohlke mentioned in his comment to your question: If you can't do pip install in cmd directly, this is what you can try: C:\Python34\python.exe -m pip install <downloaded_file>. You have to edit the path if Python3.4 is installed elsewhere, of course.

    Don't panic. If you try to install the wrong downloaded file (e. g. win32 instead of amd64), it shouldn't break anything. An error message should occur: <package name> is not a supported wheel on this platform.

    0 讨论(0)
提交回复
热议问题