Open In App

How to Install python-docx on Linux?

Word documents include formatted text wrapped in three object levels: Run objects at the lowest level, Paragraph objects at the intermediate level, and Document objects at the top level. As a result, we are unable to work with these documents using standard text editors. However, we may use the Python-Docx package to manage these word documents in Python. So, in this article, we’ll use the PIP manager to install the Docx package in Python on a Linux operating system. 

Installing Docx package on Linux using PIP

Requirements:



  1. Python3
  2. Python3-pip

To install the Docx package in Linux we have to follow the following steps:

Step 1: Setting up Python environment on our Linux operating system. So we’ll use the apt manager to install Python3.



sudo apt-get install python3

Step 2: Now we install the PIP manager. The PIP manager is a Python package installation program that is used to install and manage Python packages. So for the installation use the following command on the terminal.

sudo apt install python3-pip

Step 3: Now we’ll use the PIP manager to install the Docx package. So to install the Docx package use the following command on the terminal.

sudo pip3 install docx

Verifying installation of Docx package on Linux using PIP

After you’ve installed the package, the next step is to check whether the Docx package is properly installed or not. So, we’ll only use the terminal to get the information about the installed package (Docx).

python3 -m pip show docx

The below output will be shown in the terminal when the Docx package is successfully installed.

Article Tags :