Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No Module named xlwt

My sytem: Windows, Python 2.7

I downloaded a package and want to include it in my script.

After I unzipped the package, here is my folder structure:

  • Work
    • xlwt-0.7.3 (contains a setup.py)
      • xlwt (contains __init__.py among others)

My script runs from the top-level (Work) folder.

Using import xlwt in my script produces:

ImportError: No Module named xlwt

How do I import xlwt?

like image 802
user1289397 Avatar asked Mar 24 '12 01:03

user1289397


1 Answers

First off, try using easy_install or pip to install it into your pythonpath:

easy_install xlwt

or

pip install xlwt

These are python package managers/installers and make the whole process so much easier. But if you have already downloaded it manually, you still need to install it:

python setup.py install

Then it will be available in your python path for import. If you find that you don't have easy_install, manually download this: http://peak.telecommunity.com/dist/ez_setup.py and do python ez_setup.py, and then continue the instructions. Best choice though is to install pip and use it for your package installations. If you have easy_install, but not pip, you can do easy_install pip

like image 79
jdi Avatar answered Oct 19 '22 04:10

jdi