How to install the Six module in Python2.7

Ravi picture Ravi · Feb 24, 2014 · Viewed 104.8k times · Source

I am using Python 2.7 and trying to use dateutil as follows:

from dateutil import parser as _date_parser

However, I get the following error:

Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    from dateutil import parser as _date_parser
  File "C:\Python27\Lib\dateutil\parser.py", line 24, in <module>
    from six import text_type, binary_type, integer_types
ImportError: No module named six

Could you please let me know what is the six module for and how to get it installed in a Windows 7 machine?

Answer

zmo picture zmo · Feb 24, 2014

here's what six is:

pip search six
six                       - Python 2 and 3 compatibility utilities

to install:

pip install six

though if you did install python-dateutil from pip six should have been set as a dependency.

N.B.: to install pip run easy_install pip from command line.