gpt4 book ai didi

python - 在 Mac OS X 10.8.3 上导入 pylab 的问题

转载 作者:太空宇宙 更新时间:2023-11-04 10:47:52 25 4
gpt4 key购买 nike

导入pylab时出现如下错误:

Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/pylab.py", line 225, in <module>
import matplotlib.finance
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/finance.py", line 23, in <module>
from matplotlib.collections import LineCollection, PolyCollection
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/collections.py", line 23, in <module>
import matplotlib.backend_bases as backend_bases
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/backend_bases.py", line 50, in <module>
import matplotlib.textpath as textpath
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/textpath.py", line 11, in <module>
import matplotlib.font_manager as font_manager
File "/Library/Python/2.7/site-packages/matplotlib-1.3.x-py2.7-macosx-10.8-intel.egg/matplotlib/font_manager.py", line 1297
_fc_match_regex = re.compile(rb'\sfile:\s+"([^"]*)"')
^
SyntaxError: invalid syntax

使用自制软件安装依赖

brew install freetype
brew install libpng

通过克隆 github 存储库并执行以下操作来安装 matplotlib 和 numpy:

sudo python setup.py build
sudo python setup.py install

非常感谢解决此问题的任何帮助。

最佳答案

该文件中存在语法错误。我猜你正在使用开发资源? rb 不应该出现在正则表达式之前(在 Python 2.x 中应该是 r,在 Python 3.x 中可能是 b ).

更新:是的。这是错误的提交:

https://github.com/matplotlib/matplotlib/commit/2415c6200ebdba75a0571d71a4569f18153fff57

关于python - 在 Mac OS X 10.8.3 上导入 pylab 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16091995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com