Error loading pylab dll error

I am currently getting this error when I try to import pylab, I am just curious to know what it might be, since linux does not interact very well with this machine.

Microsoft Windows [version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\Uma>python Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win 32 >>> import pylab Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\pylab.py", line 1, in <module> from matplotlib.pylab import * File "C:\Python27\lib\site-packages\matplotlib\pylab.py", line 263, in <module> from matplotlib.pyplot import * File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 95, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 8, in <module> import Tkinter as Tk, FileDialog File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module> import FixTk File "C:\Python27\lib\lib-tk\FixTk.py", line 65, in <module> import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application. >>> quit() 

C: \ Users \ Uma>

+4
source share
1 answer

You seem to have a problem with the Tkinter package. Check if the 32-bit version is installed as you seem to be using 32-bit Python. If this does not work, you can always try using a different backend (for example, GTK or QT). To change the backend, put this at the beginning of your script (before importing pylab)

 import matplotlib matplotlib.rcParams['backend'] = 'GTKAgg' 

You can change GTKAgg to any other server . There is a few more on how to set matplotlib to its default values.

Hope this works for you.

0
source

Source: https://habr.com/ru/post/1399105/


All Articles