开发者

Unable to import pylab?

开发者 https://www.devze.com 2023-01-31 19:20 出处:网络
I\'ve installed numpy/scipy/matplotlib on Snow Leopard with python 2.6.Importing pylab does not seem to be working..Upon calling \'import pylab\', I get the following:

I've installed numpy/scipy/matplotlib on Snow Leopard with python 2.6. Importing pylab does not seem to be working.. Upon calling 'import pylab', I get the following:

File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/pylab.py", line 216, in <module>
    from matplotlib import mpl  # pulls in most modules
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl.py", line 2, in <module>
    from matplotlib import axis
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/axis.py", line 10, in <module>
    import matplotlib.font_manager as font_manager
  File "/opt/local/Library/Frameworks/Python.framewor开发者_JAVA技巧k/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1339, in <module>
    _rebuild()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1326, in _rebuild
    fontManager = FontManager()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 1004, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 343, in findSystemFonts
    for f in get_fontconfig_fonts(fontext):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py", line 301, in get_fontconfig_fonts
    output = pipe.communicate()[0]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 683, in communicate
    stdout = self.stdout.read()

What gives? Is pylab expecting something I don't have? It seems to be unable to read something, but I don't really understand what that is..


Just wait. The problem is that fc-list takes a long time to run the first time through, and so it looks like it's hung; but if you wait 2-3 minutes it will finish and then run more quickly thereafter.

I ran fc-list at the command line as root, which presumably initialized a cache of some sort; not sure that's necessary, but it worked!


try

from pylab import *

If pylab is successfully installed in your python env. There won't raise any error.

0

精彩评论

暂无评论...
验证码 换一张
取 消