Import pyplot, RuntimeError: Unable to create tklinter dlopen module file

I used pyenv to install pypy in windows bash, then use pip to install matplotlib, but when importing pyplot I got RunTimeError

 In [1]: import matplotlib.pyplot as plt --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-1-eff513f636fd> in <module>() ----> 1 import matplotlib.pyplot as plt /home/zjshao/.pyenv/versions/pypy-5.3.1/site-packages/matplotlib/pyplot.pyc in <module>() 112 113 from matplotlib.backends import pylab_setup --> 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() 115 116 _IP_REGISTERED = None /home/zjshao/.pyenv/versions/pypy-5.3.1/site-packages/matplotlib/backends/__init__.pyc in pylab_setup() 30 # imports. 0 means only perform absolute imports. 31 backend_mod = __import__(backend_name, ---> 32 globals(),locals(),[backend_name],0) 33 34 # Things we pull in from all backends /home/zjshao/.pyenv/versions/pypy-5.3.1/site-packages/matplotlib/backends/backend_tkagg.pyc in <module>() 11 12 # Paint image to Tk photo blitter extension ---> 13 import matplotlib.backends.tkagg as tkagg 14 15 from matplotlib.backends.backend_agg import FigureCanvasAgg /home/zjshao/.pyenv/versions/pypy-5.3.1/site-packages/matplotlib/backends/tkagg.pyc in <module>() 7 import numpy as np 8 ----> 9 from matplotlib.backends import _tkagg 10 11 def blit(photoimage, aggimage, bbox=None, colormode=1): RuntimeError: Cannot dlopen tkinter module file In [2]: 

So what could be the problem and how to solve this problem?

Any suggestions would be appreciated!

+7
python matplotlib pyenv
source share
1 answer

Maybe something is wrong with your python installation. The best ways are to remove python and reinstall.

I suggest you install python from Anaconda . This is the "next click" of the installer (amazing for Windows), which sets the python path environment variable and has a pre-installed package, including "mathplotlib".

0
source share

All Articles