设置:使用适用于Windows 8.1的Anaconda 2.1.0 64位安装程序中的Python 3.4.1
使用IPython 2.2.0控制台
与Anaconda安装程序一样,我随附了matplotlib 1.4.0。
我从Anaconda的默认情绪更新到0.7.6
问题:我试图以至少三种方式绘制问题文档http://docs.sympy.org/latest/modules/plotting.html#plot-geom中讨论的几何实体,这些都会产生错误。
首先尝试使用'较旧'的PygletPlot,即上述参考文档中使用的模块:
In [1]: from sympy.plotting.pygletplot import PygletPlot as Plot
In [2]: from sympy import Point, Circle
In [3]: c1 = Circle(Point(1, 0), 3)
In [4]: p = Plot(axes='label_axes=True')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-34da7d3c112c> in <module>()
----> 1 p = Plot(axes='label_axes=True')
C:\Anaconda3\lib\site-packages\sympy\plotting\pygletplot\__init__.py in PygletPlot(*args, **kwargs)
137 """
138
--> 139 import plot
140 return plot.PygletPlot(*args, **kwargs)
141
ImportError: No module named 'plot'
In [5]: Plot(c1)
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-4edba1117b3a> in <module>()
----> 1 Plot(c1)
C:\Anaconda3\lib\site-packages\sympy\plotting\pygletplot\__init__.py in PygletPlot(*args, **kwargs)
137 """
138
--> 139 import plot
140 return plot.PygletPlot(*args, **kwargs)
141
ImportError: No module named 'plot'
In [6]: p = Plot()
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-6-f2ff2ed54331> in <module>()
----> 1 p = Plot()
C:\Anaconda3\lib\site-packages\sympy\plotting\pygletplot\__init__.py in PygletPlot(*args, **kwargs)
137 """
138
--> 139 import plot
140 return plot.PygletPlot(*args, **kwargs)
141
ImportError: No module named 'plot'
第二次尝试使用“更新”的绘图模块,该模块一直被推荐用于大多数情节问题的答案:
In [1]: from sympy.plotting.plot import Plot
In [2]: from sympy import Point, Circle
In [3]: c1 = Circle(Point(1, 0), 3)
In [4]: p = Plot(c1)
In [5]: p.show()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-709f73884a30> in <module>()
----> 1 p.show()
C:\Anaconda3\lib\site-packages\sympy\plotting\plot.py in show(self)
182 if hasattr(self, '_backend'):
183 self._backend.close()
--> 184 self._backend = self.backend(self)
185 self._backend.show()
186
C:\Anaconda3\lib\site-packages\sympy\plotting\plot.py in __new__(cls, parent)
1054 matplotlib = import_module('matplotlib', min_module_version='1.1.0', catch=(RuntimeError,))
1055 if matplotlib:
-> 1056 return MatplotlibBackend(parent)
1057 else:
1058 return TextBackend(parent)
C:\Anaconda3\lib\site-packages\sympy\plotting\plot.py in __init__(self, parent)
861 def __init__(self, parent):
862 super(MatplotlibBackend, self).__init__(parent)
--> 863 are_3D = [s.is_3D for s in self.parent._series]
864 self.matplotlib = import_module('matplotlib',
865 __import__kwargs={'fromlist': ['pyplot', 'cm', 'collections']},
C:\Anaconda3\lib\site-packages\sympy\plotting\plot.py in <listcomp>(.0)
861 def __init__(self, parent):
862 super(MatplotlibBackend, self).__init__(parent)
--> 863 are_3D = [s.is_3D for s in self.parent._series]
864 self.matplotlib = import_module('matplotlib',
865 __import__kwargs={'fromlist': ['pyplot', 'cm', 'collections']},
AttributeError: 'Circle' object has no attribute 'is_3D'
In [6]: Plot(c1)
Out[6]: <sympy.plotting.plot.Plot at 0x6f74ac8>
第三次尝试使用sympy文档推荐用于交互式工作的plot()函数:
In [1]: from sympy import plot
In [2]: from sympy import Point, Circle
In [3]: c1 = Circle(Point(1, 0), 3)
In [4]: plot(c1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-685b4d90c5ac> in <module>()
----> 1 plot(c1)
C:\Anaconda3\lib\site-packages\sympy\plotting\plot.py in plot(*args, **kwargs)
1274 series = []
1275 plot_expr = check_arguments(args, 1, 1)
-> 1276 series = [LineOver1DRangeSeries(*arg, **kwargs) for arg in plot_expr]
1277
1278 plots = Plot(*series, **kwargs)
TypeError: 'NoneType' object is not iterable
感谢您的关注。这是我第一次写一个问题,所以我希望我提供了足够的信息。