12

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?

vaultah
  • 44,105
  • 12
  • 114
  • 143
Ravi
  • 3,223
  • 7
  • 37
  • 49

3 Answers3

12

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.

zmo
  • 24,463
  • 4
  • 54
  • 90
6

You need to install this

https://pypi.python.org/pypi/six

If you still don't know what pip is , then please also google for pip install

Python has it's own package manager which is supposed to help you finding packages and their dependencies: http://www.pip-installer.org/en/latest/

oz123
  • 27,559
  • 27
  • 125
  • 187
2

I had the same question for macOS.

But the root cause was not installing Six. My macOS shipped Python version 2.7 was being usurped by a Python2 version I inherited by installing a package via brew.

I fixed my issue with: $ brew uninstall python@2

Some context on here: https://bugs.swift.org/browse/SR-1061

rustyMagnet
  • 3,479
  • 1
  • 31
  • 41