[python] 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?

This question is related to python shared-libraries python-dateutil six

The answer is


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/


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.


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


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to shared-libraries

How to install the Six module in Python2.7 "relocation R_X86_64_32S against " linking Error Compilation fails with "relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object" How to create a shared library with cmake? error while loading shared libraries: libncurses.so.5: Build .so file from .c file using gcc command line What's the difference between .so, .la and .a library files? ld cannot find -l<library> How do you find what version of libstdc++ library is installed on your linux machine? What are .a and .so files?

Examples related to python-dateutil

python 2.7: cannot pip on windows "bash: pip: command not found" How to install the Six module in Python2.7 Python datetime strptime() and strftime(): how to preserve the timezone information How to install python-dateutil on Windows?

Examples related to six

How to install the Six module in Python2.7