English 中文(简体)
Problem import pylab in Hugo 8.1
原标题:Problem importing pylab in Ubuntu 8.1
  • 时间:2010-03-10 16:26:12
  •  标签:
  • python

I have installed numpy1.3,scipy 0.7.1,matplotlib 0.99.1.1 and python 2.5 when I import pylab I get the following error. Someone please help.

 /var/lib/python-support/python2.5/gtk-2.0/gtk/__init__.py:72: GtkWarning: could not open display
      warnings.warn(str(e), _gtk.Warning)
    /usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py:44: GtkWarning: gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)  failed
      cursors.MOVE          : gdk.Cursor(gdk.FLEUR),
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python2.5/site-packages/pylab.py", line 1, in <module>
        from matplotlib.pylab import *
      File "/usr/lib/python2.5/site-packages/matplotlib/pylab.py", line 247, in <module>
        from matplotlib.pyplot import *
      File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 78, in <module>
        new_figure_manager, draw_if_interactive, show = pylab_setup()
      File "/usr/lib/python2.5/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
        globals(),locals(),[backend_name])
      File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
        from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,
      File "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py", line 44, in <module>
        cursors.MOVE          : gdk.Cursor(gdk.FLEUR),
    RuntimeError: could not create GdkCursor object
最佳回答

尝试使用不同于Gtk的背书进行策划。

1. 开放 p虫和类型:

>>> import matplotlib
>>> matplotlib.matplotlib_fname()

This will print a file name. Edit this file and modify the section Backend and change Gtk or GtkAgg with any other (see the documentation in the same file), until you get it working. You can find more information about backends here.

至于为何在你试图使用背书时出现错误,这取决于你是如何安装图书馆的,以及你在电脑上安装的。 我建议安装同异构体/异构体的校正,并选择所有选用地。

问题回答

暂无回答




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签