If you are using python 3x don't do pip install docx
instead go for
pip install python-docx
It is compatible with python 3.x
Official Documentation available here: https://pypi.org/project/python-docx/
When want to use import docx
, be sure to install python-docx, not docx.You can install the module by running pip install python-docx
.
The installation name docx is for a different module However,
when you are going to import the python-docx module,
you’ll need to run
import docx
, not import python-docx
.
if still you want to use docx module then:
First of all, you will need to make sure that the docx module is installed.
If not then simply run pip install docx
.
If it shows '*requirement already satisfied*'
then the solution is :
Open docx.py file in text editor and find this code
from exceptions import PendingDeprecationWarning
try:
from exceptions import PendingDeprecationWarning
except ImportError:
pass
pip uninstall docx
python_docx-0.8.6-py2.py3-none-any.whl
file from http://www.lfd.uci.edu/~gohlke/pythonlibs/
pip install python_docx-0.8.6-py2.py3-none-any.whl
to reinstall docx.This solved the above import error smoothly for me.
You may be install docx
, not python-docx
You can see this for install python-docx
http://python-docx.readthedocs.io/en/latest/user/install.html#install
If you're using python 3.x, Make sure you have both python-docx & docx installed.
Installing python-docx :
pip install python-docx
Installing docx :
pip install docx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With