Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named cycler

I am using wxpython and matplotlib to develop a software,when I complete my work, I want to convert the python files to "*.exe" file by py2exe,so it can be used in Windows.Here is the "setup.py" file.

from distutils.core import setup  
import py2exe  
import sys  
includes = ["encodings", "encodings.*"]    
sys.argv.append("py2exe")  
options = {"py2exe":   { "bundle_files": 1 ,"dll_excludes":["MSVCP90.dll"]}}   
setup(options = options,  
      zipfile=None,   
      console = [{"script":'test.py'}])

Then I executed this script by python setup.py to generate test.exe,and it worked.

When I executed test.exe there post an error ImportError: No module named cycler

And then, I try to execute import cycler in python shell,and there is no error occur. Also,I checked the python directory c:/python27/Lib/site-packages/, and the cycler-0.9.0-py2.7.egg file exists here.

How to deal with this problem.

like image 221
Elivis Avatar asked Dec 10 '15 08:12

Elivis


2 Answers

matplotlib calls cycler and it seems cycler has not been introduced to matplotlib, which is the cause of the above error.

To fix this issue just open Terminal (or command prompt) and try to run the command

$ sudo pip install cycler if you have pip installed

OR

$ sudo easy_install -U cycler if you have easy_install installed.

If this command is successfully executed, it should look like matplotlib can use it.

Even I had this problem, when I executed this command my problem got solved.

like image 80
Farooque Avatar answered Oct 20 '22 00:10

Farooque


In case you are using anaconda, use:

conda install cycler
like image 7
Prakhar Agarwal Avatar answered Oct 20 '22 01:10

Prakhar Agarwal