Python Installing docx Dependency Package Tutorial

  • 2021-09-24 22:53:11
  • OfStack

Method 1.

The main problem is that docx is affected by lxml, and if the version of lxml is wrong, docx will not fit at all, whether you use pip, easy_install or use source code package.

Download the corresponding lxml version at https://pypi.python.org/simple/lxml/, and install it directly after installation!

Method 2.

If you are installing python 2.6, you need to upgrade python to 2.7, and then install it with pip install python-docx command

Supplement: Python-docx installation failed

Error report: 'libxml/xmlversion. h' file not found

First enter at the terminal:


xcode-select  In fact, in fact, the install

Will be prompted to install, install

And then again


pip install python-docx

If reported again:

error: could not create '/Library/Python/2. 7/site-packages/lxml': Permission denied

Add sudo as follows:


sudo pip install python-docx

At this point, I have solved it!


Related articles: