Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install the Six module in Python2.7

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?

like image 643
Ravi Avatar asked Feb 24 '14 14:02

Ravi


People also ask

What is the six Python module?

Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with the goal of writing Python code that is compatible on both Python versions.


1 Answers

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.

like image 194
zmo Avatar answered Sep 22 '22 18:09

zmo