在Mountain Lion上成功安装后,Matplotlib无法正常工作 [英] Matplotlib not working after successful installation on Mountain Lion

查看:61
本文介绍了在Mountain Lion上成功安装后,Matplotlib无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 matplotlib 网站上列出的所有依赖项.但是,它仍然不起作用.我在下面列出了python堆栈跟踪并安装了python软件包.那么,我该如何解决这个问题?

I installed all the dependencies listed on the matplotlib website. However, it still doesn't work. I listed the python stack trace and installed python packages below. So, how can I solve this problem?

Python堆栈跟踪:

Python stack trace:

>>> import pylab
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/Library/Python/2.7/site-packages/matplotlib/pylab.py", line 229, in <module>
    import matplotlib.finance
  File "/Library/Python/2.7/site-packages/matplotlib/finance.py", line 37, in <module>
    from matplotlib.collections import LineCollection, PolyCollection
  File "/Library/Python/2.7/site-packages/matplotlib/collections.py", line 26, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/Library/Python/2.7/site-packages/matplotlib/backend_bases.py", line 54, in <module>
    import matplotlib.textpath as textpath
  File "/Library/Python/2.7/site-packages/matplotlib/textpath.py", line 18, in <module>
    import matplotlib.font_manager as font_manager
  File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 1354, in <module>
    _rebuild()
  File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 1339, in _rebuild
    fontManager = FontManager()
  File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 987, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 316, in findSystemFonts
    for f in get_fontconfig_fonts(fontext):
  File "/Library/Python/2.7/site-packages/matplotlib/font_manager.py", line 280, in get_fontconfig_fonts
    for line in output.split('\n'):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 16560: ordinal not in range(128)

安装的python包:

Installed python packages:

>$ pip freeze
PyRSS2Gen==1.0.0
Twisted==12.0.0
altgraph==0.9
bdist-mpkg==0.4.4
bonjour-py==0.3
macholib==1.4.2
matplotlib==1.4.x
modulegraph==0.9.1
nose==1.3.0
numpy==1.7.1
py2app==0.6.3
pyOpenSSL==0.13
pyobjc-core==2.3.2a0
pyobjc-framework-AddressBook==2.3.2a0
pyobjc-framework-AppleScriptKit==2.3.2a0
pyobjc-framework-AppleScriptObjC==2.3.2a0
pyobjc-framework-Automator==2.3.2a0
pyobjc-framework-CFNetwork==2.3.2a0
pyobjc-framework-CalendarStore==2.3.2a0
pyobjc-framework-Cocoa==2.3.2a0
pyobjc-framework-Collaboration==2.3.2a0
pyobjc-framework-CoreData==2.3.2a0
pyobjc-framework-CoreLocation==2.3.2a0
pyobjc-framework-CoreText==2.3.2a0
pyobjc-framework-DictionaryServices==2.3.2a0
pyobjc-framework-ExceptionHandling==2.3.2a0
pyobjc-framework-FSEvents==2.3.2a0
pyobjc-framework-InputMethodKit==2.3.2a0
pyobjc-framework-InstallerPlugins==2.3.2a0
pyobjc-framework-InstantMessage==2.3.2a0
pyobjc-framework-InterfaceBuilderKit==2.3.2a0
pyobjc-framework-LatentSemanticMapping==2.3.2a0
pyobjc-framework-LaunchServices==2.3.2a0
pyobjc-framework-Message==2.3.2a0
pyobjc-framework-OpenDirectory==2.3.2a0
pyobjc-framework-PreferencePanes==2.3.2a0
pyobjc-framework-PubSub==2.3.2a0
pyobjc-framework-QTKit==2.3.2a0
pyobjc-framework-Quartz==2.3.2a0
pyobjc-framework-ScreenSaver==2.3.2a0
pyobjc-framework-ScriptingBridge==2.3.2a0
pyobjc-framework-SearchKit==2.3.2a0
pyobjc-framework-ServerNotification==2.3.2a0
pyobjc-framework-ServiceManagement==2.3.2a0
pyobjc-framework-SyncServices==2.3.2a0
pyobjc-framework-SystemConfiguration==2.3.2a0
pyobjc-framework-WebKit==2.3.2a0
pyobjc-framework-XgridFoundation==2.3.2a0
pyparsing==2.0.1
python-dateutil==2.1
scipy==0.12.0
six==1.4.1
stevedore==0.11
tornado==3.1.1
virtualenv==1.10.1
virtualenv-clone==0.2.4
virtualenvwrapper==4.1.1
wsgiref==0.1.2
xattr==0.6.2
zope.interface==3.5.1

推荐答案

这是 matplotlib 1.4.x 中的一个错误,其中 fontmanager.py 试图导入名称包含非 ascii 的字体字符.

This is a bug in matplotlib 1.4.x where fontmanager.py is trying to import a font whose name contains a non-ascii character.

您的问题类似于这个给出的补丁不会帮助你,因为你安装了 matplotlib 1.4.x 而不是 1.3.0.

Your question is similar to this one but the patch given won't help you because you have matplotlib 1.4.x installed and not 1.3.0.

正如上面问题中所建议的,您可以查看您的字体列表并尝试删除带有非 ascii 字符的字体.特别注意 Æ.

As suggested in the question above, you can take a look at your font list and try removing fonts with non ascii characters. Look especially for Æ.

或者,您可以尝试升级到似乎是已修复:

Or, you can try upgrading to the development version of matplotlib where it seems to be fixed:

pip install git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib-dev

这篇关于在Mountain Lion上成功安装后,Matplotlib无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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