为什么保存按钮在matplotlib图上不起作用? [英] Why doesn't the save button work on a matplotlib plot?

查看:154
本文介绍了为什么保存按钮在matplotlib图上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS X 10.6的Python 2.7 virtualenv中安装了 matplotlib 1.0.0 .我可以创建好图.但是,每当按下 Save 按钮时,都无法在保存"对话框窗口中键入文本,也无法保存图形.我唯一能做的就是取消.关于什么原因以及如何解决它有任何想法吗?

I have matplotlib 1.0.0 installed in a Python 2.7 virtualenv on Mac OS X 10.6. I can create plots fine. However, whenever I press the Save button, I can't type text into the save dialog window nor can I save the plot. The only thing I can do is hit cancel. Any thoughts on what's causing this and how to fix it?

我通过克隆 astraw的matplotlib github存储库安装了matplotlib,然后松散地跟随了

I installed matplotlib by cloning astraw's matplotlib github repository and then loosely following HyperJeff's Installation Instructions for numpy/scipy/matplotlib. Below are the potentially relevant sections of setup.cfg and make.osx, including the sections that I modified prior to compiling and installing.

[egg_info]
tag_svn_revision = 1

[directories]
basedirlist = /Users/matthew/.virtualenvs/matplotlib-test

[status]
#suppress = True
#verbose = True

[provide_packages]

[gui_support]
#gtk = False
#gtkagg = False
#tkagg = False
wxagg = False
#macosx = False

[rc_options]
backend = MacOSX
#numerix = numpy

make.osx

# build mpl into a local install dir with
PREFIX=/Users/matthew/.virtualenvs/matplotlib-test
MPLVERSION=1.0rc1
PYVERSION=2.7
PYTHON=python${PYVERSION}
ZLIBVERSION=1.2.3
PNGVERSION=1.2.39
FREETYPEVERSION=2.3.11
MACOSX_DEPLOYMENT_TARGET=10.6
OSX_SDK_VER=10.6
ARCH_FLAGS="-arch i386-arch x86_64"

## You shouldn't need to configure past this point (but I did...)

PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="${ARCH_FLAGS} -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
LDFLAGS="${ARCH_FLAGS} -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"

PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
CFLAGS="-arch i386 -arch x86_64 -I${PREFIX}/include -I${PREFIX}/include/freetype2 -isysroot /Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
LDFLAGS="-arch i386 -arch x86_64 -L${PREFIX}/lib -syslibroot,/Developer/SDKs/MacOSX${OSX_SDK_VER}.sdk"
FFLAGS="-arch i386 -arch x86_64"

修改setup.cfgmake.osx之后,我发出了以下命令来安装matplotlib:

After modifying setup.cfg and make.osx, I issued the following commands to install matplotlib:

make -f make.osx fetch deps mpl_build mpl_install
python setup.py install

注意:不需要sudo,因为我要安装到virtualenv中,而不是像HyperJeff那样安装到站点程序包中.

Note: sudo isn't required, since I'm installing into a virtualenv instead of into the site-packages like HyperJeff is doing.

我使用python.org的 Python 2.7 PPC/i386/x86-64 Mac OS X用于Mac OS X 10.5的安装程序磁盘映像安装了Python 2.7.感谢

I installed Python 2.7 using python.org's Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image for Mac OS X 10.5. Thanks to Ned Deily's answer to this SO question, I know that this version of Python 2.7 cannot run IDLE or Tkinter on Mac OS X 10.6.

  1. 我安装的Python 2.7版本是否可能是问题的原因?我是否应该使用 Python 2.7 32位Mac OS X安装程序磁盘映像(适用于Mac OS X 10.3至10.6 )重新安装Python 2.7?
  2. 是否需要在setup.cfg中进行配置然后重新编译matplotlib的其他gui_support选项?
  1. Could the version of Python 2.7 that I have installed be the cause of the problem? Should I reinstall Python 2.7 using the Python 2.7 32-bit Mac OS X Installer Disk Image for Mac OS X 10.3 through 10.6?
  2. Is there a different gui_support option that I need to configure in setup.cfg and then recompile matplotlib?

更新,2010年9月13日,下午3:33

其他Mac OS X和matplotlib用户似乎有相同的问题.在matplotlib-用户邮件列表中,两个用户报告说在Mac OS X 10.5上有相同的问题.尽管它们运行的​​是matplotlib 0.99.1.1和0.99.1.2,而我安装的是matplotlib 1.0.0.

Update, September 13, 2010, 3:33 PM

It appears that other Mac OS X and matplotlib users are having the same problem. In the matplotlib-users mailing list, two users reported having the same problem on Mac OS X 10.5. Although, they were running matplotlib 0.99.1.1 and 0.99.1.2 versus matplotlib 1.0.0 that I have installed.

matplotlib错误2973874 于2010年3月20日以同样的问题开放.但是,它的优先级为5,自该bug最初被打开以来就没有被修改.下面是对该错误的描述:

matplotlib bug 2973874 was opened on 20-Mar-10 with the same issue. However, it's a priority 5 and hasn't been modified since the bug was originally opened. Below is the description from the bug:

我正在运行6.0.1的Python发行版64位Mac.如果运行图并单击保存",则会打开一个保存对话框窗口,我无法在文件名"字段中输入文本.我可以选择一个现有文件,但仍然不能修改名称.如果我选择一个非png文件,它不会覆盖它.我得到了一个具有相同名称但具有png扩展名的文件.

I am running the 6.0.1 enthought python distibution 64bit Mac. If a run a plot and click save I get a save dialog window that opens, I canot enter text in the file name field. I can select an existing file but still cannot modify the name. If I select a non png file it does not overwrite it. I get a file with the same name but with the png extension.

推荐答案

您需要使OSX确信virtualenv实际上是从Application Bundle运行的.修复此处讨论:

You need to convince OSX that the virtualenv is actually running from an Application Bundle. Fix discussed here:

http://groups.google.com/group/python-virtualenv/browse_thread/thread/83fa4a12d22a30c8/744e19c194f1618a

并在此处实现:

https://github.com/gldnspud/virtualenv-pythonw-osx

这篇关于为什么保存按钮在matplotlib图上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆