Installing lxml, libxml2, libxslt on Windows 8.1

后端 未结 4 989
不知归路
不知归路 2020-12-02 19:04

After additional exploration, I found a solution to installing lxml with pip and wheel. Additional comments on approach welcomed.

I\'m finding the existing Python

相关标签:
4条回答
  • 2020-12-02 19:37

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

    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
    

    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
    

    The results were:

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

    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. Need to install the desired module (as a "*.whl" file) using pip and wheel.
    2. Using Dropbox to share a code folder with different PyCharm installations causes confusion for the "workspace.xml" file. The two computers kept writing over each other, messing up the installation paths.

    Hope this helps.

    0 讨论(0)
  • 2020-12-02 19:37

    I started working with lxml a little while ago, when there was a need to parse some html files. I somehow installed it and then after some time I lost the installation because of PC format.

    Installing lxml on Windows from the available binaries/wheels is quite easy. The below link has the binaries/wheels in case you need them.

    http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

    After downloading the wheel file as per your Windows you can issue the below command pip install <pathtoyourdownloadedwheelfile>

    And In case you are using git-sdk-win32 for Windows, You can first search the libxml2-devel,libxml2-python and libxslt-devel, libxslt-python using pacman by issuing the below command.

    pacman -Ss libxml2

    and

    pacman -Ss libxslt

    then you can install lxml using the below command

    pip install lxml It might fail to build the wheel(as it did for me) but will install lxml using the setup.py

    I simply have started loving this git-win32-sdk. It helps me work on my Windows with what I have learnt on Linux.

    https://github.com/git-for-windows/build-extra/releases

    0 讨论(0)
  • 2020-12-02 19:38

    My situation was a lot like this. I have Python 3.4 installed on my Laptop for work, and we're in a tight security, so I can't just install 3.5 without getting system admin to do it.

    So I hit up Python Extension site here:

    http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

    Pulled the wheel file for lxml that matched my specs:

    lxml-3.6.4-cp34-cp34m-win_amd64.whl
    

    And then just typed:

    pip install lxml-3.6.4-cp34-cp34m-win_amd64.whl
    

    And it installed right away.

    0 讨论(0)
  • 2020-12-02 19:42

    This issue appears to be fixed as of lxml version 4.2.5.

    If you're still getting this error and you're specifying a specific version of lxml in a requirements file, try updating the requirements file to specify lxml version 4.2.5 or above.

    I had this error with lxml 4.2.1. But it was fixed when I changed the requirement to lxml 4.2.5.

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