3

I am new to Python/OpenCV.

I have the code below run in Python. But I got an error as shown below.

>>> from matplotlib import pyplot as plt

Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    from matplotlib import pyplot as plt
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
    import six
ImportError: No module named six

I followed what is being suggested in this post: ImportError: No module named six

I have downloaded six-1.8.0.tar.gz and unzip the file. I am wondering of is the next thing to do? I tried to run the six.py but I still got the same error.

Community
  • 1
  • 1
user3988645
  • 135
  • 2
  • 4
  • 14

2 Answers2

4

You shouldn't need to download the tar.gz file. Instead run this at the command line (note, not the Python command line):

pip install six

And if that doesn't work, try:

easy_install six

twasbrillig
  • 17,084
  • 9
  • 43
  • 67
  • Tried this one, but got an error. 'pip' is not recognized .... same with 'easy_install' – user3988645 Nov 11 '14 at 07:34
  • 1
    Here are directions to install pip, you can try them out: http://pip.readthedocs.org/en/latest/installing.html – twasbrillig Nov 11 '14 at 07:38
  • I have used cmd. the error is 'pip' is not recognized as an internal or external command, operable program or batch file. – user3988645 Nov 11 '14 at 07:47
  • I have tried that link, and I am very confused. I tried the command and got an error. – user3988645 Nov 11 '14 at 07:47
  • 5
    I was able to successfully installed six but when I tried to run again "from matplotlib import pyplot as plt" I got the same error "import six ImportError: No module named six" – user3988645 Nov 11 '14 at 08:31
  • I have this same exact issue, and even though six seems to be installed everywhere, I get the import error. Was this problem fixed at all? – jotNewie Aug 19 '19 at 10:12
0

I met the same problem (No module named six) when I tried to import nltk and to type easy_install six in cmd (Windows), it installed six for me.

And I imported nltk successfully.

tbraun89
  • 2,246
  • 3
  • 25
  • 44
Roy Chen
  • 131
  • 1
  • 3