简体   繁体   中英

how to install texttable in python

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.

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 .

  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

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

ps 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 :¬)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM