我使用三种不同的方式导入Plot功能。都失败了。 1:
from sympy import *
if __name__ == '__main__':
pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
print pp1.evalf(),pp2.evalf()
p=Plot()
p[0]=el1
p[1]=el2
p[2]=Segment(pp1,pp2)
p.show()
节目:
Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=Plot()
2:
from sympy import Point, Ellipse, intersection, Segment,plot
import math
def
...
if __name__ == '__main__':
pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
print pp1.evalf(),pp2.evalf()
p=plot.Plot()
p[0]=el1
p[1]=el2
p[2]=Segment(pp1,pp2)
p.show()
节目:
Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=plot.Plot()
AttributeError: 'function' object has no attribute 'Plot'
3
from sympy import Plot
节目:
Traceback (most recent call last):
File "E:\Project\Build up\programming\learn\learn.py", line 7, in <module>
from sympy import Plot
ImportError: cannot import name Plot
请帮助如何从sympy-0.7.6导入Plot。
我也尝试过: 从sympy.plotting.pygletplot导入PygletPlot作为Plot 但也有错误: { Traceback(最近一次调用最后一次): 文件&#34; C:\ Users \ Erdong \ workspace \ Gungeo \ src \ gungeo.py&#34;,第92行,在 P =剧情(EL1) 文件&#34; C:\ Python27 \ lib \ site-packages \ sympy \ plotting \ pygletplot__init __。py&#34;,139行,在PygletPlot中 进口情节 文件&#34; C:\ Python27 \ lib \ site-packages \ sympy \ plotting \ pygletplot \ plot.py&#34;,第16行,in 来自plot_axes导入PlotAxes 文件&#34; C:\ Python27 \ lib \ site-packages \ sympy \ plotting \ pygletplot \ plot_axes.py&#34;,第7行,in 来自util import strided_range,billboard_matrix 文件&#34; C:\ Python27 \ lib \ site-packages \ sympy \ plotting \ pygletplot \ util.py&#34;,第8行,in def get_model_matrix(array_type = c_float,glGetMethod = glGetFloatv): NameError:name&#39; c_float&#39;没有定义 }
答案 0 :(得分:1)
看看http://docs.sympy.org/latest/modules/plotting.html。它应该是
from sympy import symbols
from sympy.plotting import plot
x = symbols('x')
p = plot(x)
答案 1 :(得分:0)
也许你想要使用pyglet的旧Plot:
from sympy.plotting.pygletplot import PygletPlot as Plot