python - Matplotlib 无法导入,显示为类型错误
问题描述
我在osx机器上。Matplotlib 几天前工作正常,但今天当我想使用它时,它却无法导入。有一堆行,在底部它给了我一个类型错误,关于需要另一个变量的复制函数。我已经尝试重新安装它,但仍然不会让步。有什么想法吗?我对此还很陌生,所以我不知道发生了什么。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/__init__.py", line 138, in <module>
from . import cbook, rcsetup
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/rcsetup.py", line 24, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/fontconfig_pattern.py", line 18, in <module>
from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyparsing.py", line 5658, in <module>
_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group(OneOrMore(_charRange | _singleChar)).setResultsName("body") + "]"
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyparsing.py", line 1480, in setResultsName
return self._setResultsName(name, listAllMatches)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyparsing.py", line 1483, in _setResultsName
newself = self.copy()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyparsing.py", line 1437, in copy
cpy = copy.copy(self)
TypeError: copy() missing 2 required positional arguments: 'E' and 'X'
解决方案
感谢您的回复,原来 matplotlib 不喜欢我所在的目录,这很奇怪。只是改变我试图从工作中运行它的位置。
推荐阅读
- vaadin - Vaadin 11 - 如何在 application.yml 中设置 productionMode
- regex - Python 2.7 正则表达式与所需模式不匹配
- spring - 在类路径中找不到属性文件 - 部署 EAR 时出错
- javascript - 分支 IO 和反应网络应用程序:'分支'未定义
- ios - 向 iOS 用户显示企业应用程序正在安装
- java - FragmentPagerAdapter Fragment getItem 位置错误?
- c++ - QGraphicsWidget中的FramelessWindowHint?
- azure - Azure AD B2C Microsoft 帐户 redirect_uri 失败
- regex - 至少包含 x 个字符和 x 个数字的正则表达式匹配字符串
- android - Android从网站中提取多个表