Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/345.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 绘制简单图形_Python_Matplotlib - Fatal编程技术网

Python 绘制简单图形

Python 绘制简单图形,python,matplotlib,Python,Matplotlib,我正在尝试使用python绘制一个简单的图形。 我使用的代码如下 import matplotlib.pyplot as plt plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show() 它向我抛出一个名为的错误(导入错误:没有名为_path的模块) 错误消息如下所示 Traceback (most recent call last): File "C:/Users/s siddharth kumar/Desktop/graph2.

我正在尝试使用python绘制一个简单的图形。 我使用的代码如下

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()
它向我抛出一个名为的错误(导入错误:没有名为_path的模块) 错误消息如下所示

Traceback (most recent call last):
  File "C:/Users/s siddharth kumar/Desktop/graph2.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python27\lib\matplotlib\pyplot.py", line 26, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Python27\lib\matplotlib\figure.py", line 24, in <module>
    import matplotlib.artist as martist
  File "C:\Python27\lib\matplotlib\artist.py", line 7, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "C:\Python27\lib\matplotlib\transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: No module named _path
回溯(最近一次呼叫最后一次):
文件“C:/Users/s siddharth kumar/Desktop/graph2.py”,第1行,在
将matplotlib.pyplot作为plt导入
文件“C:\Python27\lib\matplotlib\pyplot.py”,第26行,在
从matplotlib.figure导入FigSpect图形
文件“C:\Python27\lib\matplotlib\figure.py”,第24行,在
将matplotlib.artist作为martist导入
文件“C:\Python27\lib\matplotlib\artist.py”,第7行,在
从transforms导入Bbox、IdentityTransform、TransformedBbox、\
文件“C:\Python27\lib\matplotlib\transforms.py”,第35行,在
从matplotlib.\u路径导入(仿射变换、计数\u盒\u重叠\u盒,
ImportError:没有名为_path的模块

我是否需要在系统变量或任何东西中更改运行python的路径?,?我安装了numpy、matplotlib和所有工具,但仍然无法在图形上绘制这些简单的值。

您运行的是哪个操作系统和matplotlib版本?在我的win7和matplotlib 1.2.1上,这可以正常工作。也许您可以自己构建matplotlib解决问题请参阅:似乎有一个基础cextensions未正确编译。我使用的是Windows 7 enterprise(32位)操作系统,matplotlib的版本为1.3.1文件信息是什么?需要x和y轴进行打印。