Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Python docx module on mac osx

I'm trying to generate .docx files using Python. I searched the web and posts here and found a module:

https://github.com/mikemaccana/python-docx/blob/master/README.markdown

It says to install using easy_install or pip, which I have no idea how to do. I went to python website to install pip from the instructions given on python documentation:

http://guide.python-distribute.org/installation.html

So I downloaded and followed directions:

$ tar xzf pip-0.7.2.tar.gz
$ cd pip-0.7.2
$ python setup.py install

But when I do python setup.py install, I get error message:

Johns-MacBook-Pro:pip-0.7.2 John$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 2, in <module>
from setuptools import setup

ImportError: No module named setuptools

Can someone please help me install step by step for a newb? Thanks in advance for all of your help!

like image 485
user1527227 Avatar asked Feb 25 '26 16:02

user1527227


1 Answers

Pip can install straight from the git repository

You just have to tell him to use git and give him the URL of the git rep

pip install git+git://github.com/mikemaccana/python-docx.git

You will also need to install lxml (as written in the setup.py) and PIL (as you will discover when you try to import the module).

pip install PIL
pip install lxml
pip install python-dateutil
like image 109
Jeff Avatar answered Feb 28 '26 05:02

Jeff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!