问题描述
我正在尝试使用matplotlib绘制一些数据.导入库时,出现错误:
I am trying to plot some data using matplotlib. When importing the library, I get the error:
ImportError: matplotlib requires pyparsing
我使用 easy_install pyparsing
安装了pyparsing,但是错误不断出现.
I installed pyparsing using easy_install pyparsing
, but the error keeps appearing.
我该如何解决这个问题?或者,是否有任何替代 matplotlib 来使用 Python 绘制内容的方法?
How can I solve this problem? Alternatively, is there any alternative to matplotlib to plot stuff with Python?
sys.path
返回:
['', 'C:\\Python27\\lib\\site-packages\\spyderlib\\utils\\external', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\lib\\site-packages\\Orange\\orng', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\win32', 'C:\\Python27\\lib\\site-packages\\win32\\lib', 'C:\\Python27\\lib\\site-packages\\Pythonwin', 'C:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\Python27\\lib\\site-packages\\IPython\\extensions']
尝试导入pyparsing返回错误:
Trying to import pyparsing returns the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 540, in runfile
execfile(filename, namespace)
File "C:/Python27/Lib/site-packages/xy/simulation.py", line 4, in <module>
import pyparsing
ImportError: No module named pyparsing
推荐答案
如果值得,也可以尝试通过pip安装.如果您需要安装脚本,请使用快速链接:Stackoverflow 帖子.无论如何,然后只需使用:
For what it's worth you could also try installing via pip if you have it. Quick link if you need an install script: Stackoverflow post.Anyways, then just use:
pip install pyparsing
这篇关于matplotlib 需要 pyparsing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!