how to install texttable in python

13.4k views Asked by At

My code is:

import texttable as tt  
tab = tt.TextTable()  
header = ['Manager', 'Club', 'Year']  
tab.header(header)  
print tab.draw()  

During execution the following error occurs.

ImportError: No module named texttable

Can anyone help me with the steps to install texttable or with other solutions.

3

There are 3 answers

1
Happy On BEST ANSWER

You have to download the module from the python website.

Decompress the archive, and go into the directory. Then execute the script setup.py with install in argument:

python setup.py install

You can find more information in the documentation.

0
E.Z. On
  1. Download pip from https://pypi.python.org/packages/source/p/pip/pip-1.5.2.tar.gz

  2. Unzip the contents to any <dir>

  3. cd <dir>

  4. python setup.py install

  5. Install texttable calling pip install texttable

0
joe_evans On

I have installed texttable with python3.

I ran your code and received the same error!

I changed this -->>tab = tt.TextTable() to this -->> tab = tt.Texttable()

note the lower case 't' and all went well.

Hope this helps

p.s. I have just realised that this reply is in 2020 and your question was in 2014. You are now probably much older and the CEO of a huge Blue Chip company!!! Sorry I'm late :¬)