sympy 0.7.1 情节不起作用

sympy 0.7.1 plot does not work

我该如何解决这个问题,或者找到日志来调查它?

$ python
Python 2.7.3 (default, Dec 18 2014, 19:10:20) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from sympy import symbols
>>> from sympy.plotting import plot
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
>>> x = symbols('x')
>>> p1 = plot(x*x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> import sympy
>>> sympy.__version__
'0.7.1.rc1'

好像绘图模块还没有完全安装?

this seems to be a very old version of sympy. the api has changed. in sympy 0.7.1.rc1, plot is a module, not a function.

我通过删除 mpmathsympy 的现有版本(已与 apt 一起安装)并安装最新版本解决了这个问题,如下所示:

$ sudo apt-get remove --purge python-mpmath python-sympy
$ sudo python -m easy_install mpmath
$ python
Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mpmath
>>> mpmath.__version__
'0.19'
$ sudo python -m easy_install sympy
$ python
Python 2.7.3 (default, Mar 14 2014, 11:57:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sympy
>>> sympy.__version__
'0.7.6'

现在 plot() 显示图表。

以后,使用python -m easy_install安装最新版本,而不是apt-get,似乎有旧版本。